|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.util.EventObject | +--java.awt.AWTEvent | +--java.awt.event.ComponentEvent | +--java.awt.event.InputEvent | +--java.awt.event.MouseEvent
Safe:
Field Summary | |
(package private) int |
button
Indicates which, if any, of the mouse buttons has changed state. |
static int |
BUTTON1
Enabled: Indicates mouse button #1; used by getButton() . |
static int |
BUTTON2
Enabled: Indicates mouse button #2; used by getButton() . |
static int |
BUTTON3
Enabled: Indicates mouse button #3; used by getButton() . |
(package private) int |
clickCount
Indicates the number of quick consecutive clicks of a mouse button. |
static int |
MOUSE_CLICKED
Enabled: The "mouse clicked" event. |
static int |
MOUSE_DRAGGED
Enabled: The "mouse dragged" event. |
static int |
MOUSE_ENTERED
Enabled: The "mouse entered" event. |
static int |
MOUSE_EXITED
Enabled: The "mouse exited" event. |
static int |
MOUSE_FIRST
Enabled: The first number in the range of ids used for mouse events. |
static int |
MOUSE_LAST
Enabled: The last number in the range of ids used for mouse events. |
static int |
MOUSE_MOVED
Enabled: The "mouse moved" event. |
static int |
MOUSE_PRESSED
Enabled: The "mouse pressed" event. |
static int |
MOUSE_RELEASED
Enabled: The "mouse released" event. |
static int |
MOUSE_WHEEL
Enabled: The "mouse wheel" event. |
static int |
NOBUTTON
Enabled: Indicates no mouse buttons; used by getButton() . |
(package private) boolean |
popupTrigger
A property used to indicate whether a Popup Menu should appear with a certain gestures. |
private static long |
serialVersionUID
|
(package private) int |
x
The mouse event's x coordinate. |
(package private) int |
y
The mouse event's y coordinate. |
Fields inherited from class java.awt.event.InputEvent |
ALT_DOWN_MASK, ALT_GRAPH_DOWN_MASK, ALT_GRAPH_MASK, ALT_MASK, BUTTON1_DOWN_MASK, BUTTON1_MASK, BUTTON2_DOWN_MASK, BUTTON2_MASK, BUTTON3_DOWN_MASK, BUTTON3_MASK, CTRL_DOWN_MASK, CTRL_MASK, JDK_1_3_MODIFIERS, META_DOWN_MASK, META_MASK, modifiers, SHIFT_DOWN_MASK, SHIFT_MASK, when |
Fields inherited from class java.awt.event.ComponentEvent |
COMPONENT_FIRST, COMPONENT_HIDDEN, COMPONENT_LAST, COMPONENT_MOVED, COMPONENT_RESIZED, COMPONENT_SHOWN |
Fields inherited from class java.util.EventObject |
source |
Constructor Summary | |
MouseEvent(Component source,
int id,
long when,
int modifiers,
int x,
int y,
int clickCount,
boolean popupTrigger)
Suppressed: Constructs a MouseEvent object with the
specified source component,
type, modifiers, coordinates, and click count. |
|
MouseEvent(Component source,
int id,
long when,
int modifiers,
int x,
int y,
int clickCount,
boolean popupTrigger,
int button)
Suppressed: Constructs a MouseEvent object with the
specified source component,
type, modifiers, coordinates, and click count. |
Method Summary | |
int |
getButton()
Suppressed: Returns which, if any, of the mouse buttons has changed state. |
int |
getClickCount()
Enabled: Returns the number of mouse clicks associated with this event. |
static String |
getMouseModifiersText(int modifiers)
Suppressed: Returns a String describing the modifier key(s), such as "Shift", or "Ctrl+Shift". |
Point |
getPoint()
Enabled: Returns the x,y position of the event relative to the source component. |
int |
getX()
Enabled: Returns the horizontal x position of the event relative to the source component. |
int |
getY()
Enabled: Returns the vertical y position of the event relative to the source component. |
private static void |
initIDs()
Initialize JNI field and method IDs for fields that may be accessed from C. |
boolean |
isPopupTrigger()
Enabled: Returns whether or not this mouse event is the popup menu trigger event for the platform. |
String |
paramString()
Suppressed: Returns a parameter string identifying this event. |
private void |
readObject(ObjectInputStream s)
Sets new modifiers by the old ones. |
private void |
setNewModifiers()
Sets new modifiers by the old ones. |
private void |
setOldModifiers()
Sets old modifiers by the new ones. |
void |
translatePoint(int x,
int y)
Enabled: Translates the event's coordinates to a new position by adding specified x (horizontal) and y
(vertical) offsets. |
Methods inherited from class java.awt.event.InputEvent |
consume, getModifiers, getModifiersEx, getModifiersExText, getWhen, isAltDown, isAltGraphDown, isConsumed, isControlDown, isMetaDown, isShiftDown |
Methods inherited from class java.awt.event.ComponentEvent |
getComponent |
Methods inherited from class java.awt.AWTEvent |
getID, setSource, toString |
Methods inherited from class java.util.EventObject |
getSource |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int MOUSE_FIRST
public static final int MOUSE_LAST
public static final int MOUSE_CLICKED
MouseEvent
occurs when a mouse button is pressed and released.
public static final int MOUSE_PRESSED
MouseEvent
occurs when a mouse button is pushed down.
public static final int MOUSE_RELEASED
MouseEvent
occurs when a mouse button is let up.
public static final int MOUSE_MOVED
MouseEvent
occurs when the mouse position changes.
public static final int MOUSE_ENTERED
MouseEvent
occurs when the mouse cursor enters the unobscured part of component's
geometry.
public static final int MOUSE_EXITED
MouseEvent
occurs when the mouse cursor exits the unobscured part of component's
geometry.
public static final int NOBUTTON
getButton()
.
public static final int BUTTON1
getButton()
.
public static final int BUTTON2
getButton()
.
public static final int BUTTON3
getButton()
.
public static final int MOUSE_DRAGGED
MouseEvent
occurs when the mouse position changes while a mouse button is pressed.
public static final int MOUSE_WHEEL
MouseWheelEvent
.
It occurs when a mouse equipped with a wheel has its wheel rotated.
int x
getX()
int y
getY()
int clickCount
MOUSE_CLICKED
,
MOUSE_PRESSED
and
MOUSE_RELEASED
.
For the above, the clickCount
will be at least 1.
For all other events the count will be 0.
getClickCount().
int button
NOBUTTON
,
BUTTON1
,
BUTTON2
or
BUTTON3
.
getButton().
boolean popupTrigger
popupTrigger
= false
,
no popup menu should appear. If it is true
then a popup menu should appear.
java.awt.PopupMenu
,
isPopupTrigger()
private static final long serialVersionUID
Constructor Detail |
public MouseEvent(Component source, int id, long when, int modifiers, int x, int y, int clickCount, boolean popupTrigger, int button)
MouseEvent
object with the
specified source component,
type, modifiers, coordinates, and click count.
Note that passing in an invalid id
results in
unspecified behavior.
source
- the Component
that originated the eventid
- the integer that identifies the eventwhen
- a long int that gives the time the event occurredmodifiers
- the modifier keys down during event (e.g. shift, ctrl,
alt, meta)
Either extended _DOWN_MASK or old _MASK modifiers
should be used, but both models should not be mixed
in one event. Use of the extended modifiers is
preferred.x
- the horizontal x coordinate for the mouse locationy
- the vertical y coordinate for the mouse locationclickCount
- the number of mouse clicks associated with eventpopupTrigger
- a boolean, true if this event is a trigger for a
popup menubutton
- which of the mouse buttons has changed state.
NOBUTTON
,
BUTTON1
,
BUTTON2
or
BUTTON3
.public MouseEvent(Component source, int id, long when, int modifiers, int x, int y, int clickCount, boolean popupTrigger)
MouseEvent
object with the
specified source component,
type, modifiers, coordinates, and click count.
Note that passing in an invalid id
results in
unspecified behavior.
source
- the Component
that originated the eventid
- the integer that identifies the eventwhen
- a long int that gives the time the event occurredmodifiers
- the modifier keys down during event (e.g. shift, ctrl,
alt, meta)
Either extended _DOWN_MASK or old _MASK modifiers
should be used, but both models should not be mixed
in one event. Use of the extended modifiers is
preferred.x
- the horizontal x coordinate for the mouse locationy
- the vertical y coordinate for the mouse locationclickCount
- the number of mouse clicks associated with eventpopupTrigger
- a boolean, true if this event is a trigger for a
popup menuMethod Detail |
private static void initIDs()
public int getX()
public int getY()
public Point getPoint()
Point
object containing the x and y coordinates
relative to the source componentpublic void translatePoint(int x, int y)
x
(horizontal) and y
(vertical) offsets.
x
- the horizontal x value to add to the current x
coordinate positiony
- the vertical y value to add to the current y
coordinate positionpublic int getClickCount()
public int getButton()
public boolean isPopupTrigger()
Note: Popup menus are triggered differently
on different systems. Therefore, isPopupTrigger
should be checked in both mousePressed
and mouseReleased
for proper cross-platform functionality.
public static String getMouseModifiersText(int modifiers)
public String paramString()
paramString
in class ComponentEvent
private void setNewModifiers()
private void setOldModifiers()
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |