
 |
Chapter 21 java.awt.event Reference |
 |
MouseEvent 
Name
MouseEvent
Mouse events are generated when the user moves and clicks the mouse.
public class java.awt.event.MouseEvent
extends java.awt.event.InputEvent {
// Constants
public final static int MOUSE_CLICKED;
public final static int MOUSE_DRAGGED;
public final static int MOUSE_ENTERED;
public final static int MOUSE_EXITED;
public final static int MOUSE_FIRST;
public final static int MOUSE_LAST;
public final static int MOUSE_MOVED;
public final static int MOUSE_PRESSED;
public final static int MOUSE_RELEASED;
// Constructors
public MouseEvent (Component source, int id, long when, int modifiers, int x,
int y, int clickCount, boolean popupTrigger);
// Instance Methods
public int getClickCount();
public synchronized Point getPoint();
public int getX();
public int getY();
public boolean isPopupTrigger();
public String paramString();
public synchronized void translatePoint (int x, int y);
}
An event type ID indicating a mouse click.
An event type ID indicating a mouse move with the button held down.
An event type ID indicating that a mouse entered a component.
An event type ID indicating that a mouse left a component.
Specifies the beginning range of mouse event ID values.
Specifies the ending range of mouse event ID values.
An event type ID indicating a mouse move.
An event type ID indicating a mouse button press.
An event type ID indicating a mouse button release.
- Parameters
-
- source
-
The object that
generated the event.
- id
-
The event type ID of
the event.
- when
-
When the event occurred,
in milliseconds from the epoch.
- modifiers
-
What modifier
keys were pressed with this key.
- x
-
The horizontal location
of the event.
- y
-
The vertical location
of the event.
- clickCount
-
The number of
times the mouse button has been clicked.
- popupTrigger
-
A flag indicating
if this event is a popup trigger event.
- Description
-
Constructs a MouseEvent with
the given characteristics.
- Returns
-
The number of consecutive mouse button clicks for this event.
- Returns
-
The location where the event happened.
- Returns
-
The horizontal location where the event happened.
- Returns
-
The vertical location where the event happened.
- Returns
-
Returns true if this event
is the popup menu event for the run-time system.
- Returns
-
String with current settings of the MouseEvent.
- Overrides
-
ComponentEvent.paramString()
- Description
-
Helper method for toString()
to generate string of current settings.
- Parameters
-
- x
-
The horizontal amount
of translation.
- y
-
The vertical amount of
translation.
- Description
-
Translates the location of the event by the given amounts.
Component, ComponentEvent, InputEvent, MouseAdapter,
MouseListener, Point
|
|