public class NativeMouseEvent extends NativeInputEvent
This low-level event is generated natively for:
A NativeMouseEvent
object is passed to every
NativeMouseListener
object which is registered to receive mouse
events using the GlobalScreen.addNativeMouseListener(org.jnativehook.mouse.NativeMouseListener)
method. The
GlobalScreen
object then dispatches a
NativeMouseEvent
to each listener.
A NativeMouseEvent
object is also passed to every
NativeMouseMotionListener
object which has been registered to
receive mouse motion events using the
GlobalScreen.addNativeMouseListener(org.jnativehook.mouse.NativeMouseListener)
method. The
GlobalScreen
object then dispatches a
NativeMouseEvent
to each listener.
When a mouse button is clicked, events are generated and sent to the
registered NativeMouseListeners
. The state of modifiers can be
retrieved using NativeInputEvent.getModifiers()
. All modifiers returned
by NativeInputEvent.getModifiers()
reflect the current state of all
modifiers and buttons.
GlobalScreen
,
NativeMouseListener
,
NativeMouseMotionListener
,
Serialized FormModifier and Type | Field and Description |
---|---|
static int |
BUTTON1
Indicates mouse button #1; used by getButton().
|
static int |
BUTTON2
Indicates mouse button #2; used by getButton().
|
static int |
BUTTON3
Indicates mouse button #3; used by getButton().
|
static int |
BUTTON4
Indicates mouse button #4; used by getButton().
|
static int |
BUTTON5
Indicates mouse button #5; used by getButton().
|
static int |
NATIVE_MOUSE_CLICKED
The native mouse pressed event.
|
static int |
NATIVE_MOUSE_DRAGGED
The native mouse dragged event.
|
static int |
NATIVE_MOUSE_FIRST
The first number in the range of id's used for native mouse events.
|
static int |
NATIVE_MOUSE_LAST
The last number in the range of id's used for native mouse events.
|
static int |
NATIVE_MOUSE_MOVED
The native mouse moved event.
|
static int |
NATIVE_MOUSE_PRESSED
The native mouse pressed event.
|
static int |
NATIVE_MOUSE_RELEASED
The native mouse released event.
|
static int |
NATIVE_MOUSE_WHEEL
The native mouse dragged event.
|
static int |
NOBUTTON
Indicates no mouse buttons; used by getButton().
|
ALT_L_MASK, ALT_MASK, ALT_R_MASK, BUTTON1_MASK, BUTTON2_MASK, BUTTON3_MASK, BUTTON4_MASK, BUTTON5_MASK, CAPS_LOCK_MASK, CTRL_L_MASK, CTRL_MASK, CTRL_R_MASK, META_L_MASK, META_MASK, META_R_MASK, NUM_LOCK_MASK, SCROLL_LOCK_MASK, SHIFT_L_MASK, SHIFT_MASK, SHIFT_R_MASK
source
Constructor and Description |
---|
NativeMouseEvent(int id,
int modifiers,
int x,
int y,
int clickCount)
Instantiates a new
NativeMouseEvent object. |
NativeMouseEvent(int id,
int modifiers,
int x,
int y,
int clickCount,
int button)
Instantiates a new
NativeMouseEvent object. |
Modifier and Type | Method and Description |
---|---|
int |
getButton()
Returns which, if any, of the mouse buttons has changed state.
|
int |
getClickCount()
Returns the number of button clicks associated with this event.
|
Point |
getPoint()
Returns the x,y position of the native event.
|
int |
getX()
Returns the x coordinate of the native event.
|
int |
getY()
Returns the y coordinate of the native event.
|
String |
paramString()
Returns a parameter string identifying the native event.
|
getID, getModifiers, getModifiersText, getWhen, setModifiers
getSource, toString
public static final int NATIVE_MOUSE_FIRST
public static final int NATIVE_MOUSE_LAST
public static final int NATIVE_MOUSE_CLICKED
NativeMouseEvent
occurs when a mouse button is pressed and released.public static final int NATIVE_MOUSE_PRESSED
NativeMouseEvent
occurs when a mouse button is depressed.public static final int NATIVE_MOUSE_RELEASED
NativeMouseEvent
occurs when a mouse button is released.public static final int NATIVE_MOUSE_MOVED
NativeMouseEvent
occurs when the mouse pointer changes position.public static final int NATIVE_MOUSE_DRAGGED
NativeMouseEvent
occurs when the mouse pointer changes position while a mouse button
is pressed.public static final int NATIVE_MOUSE_WHEEL
NativeMouseEvent
occurs when the mouse wheel is rotated.public static final int NOBUTTON
public static final int BUTTON1
public static final int BUTTON2
public static final int BUTTON3
public static final int BUTTON4
public static final int BUTTON5
public NativeMouseEvent(int id, int modifiers, int x, int y, int clickCount)
NativeMouseEvent
object.id
- an integer that identifies the native event type.modifiers
- a modifier mask describing the modifier keys and mouse
buttons active for the event.
NativeInputEvent _MASK
modifiers should be used as they are
not compatible with the extended _DOWN_MASK or the old _MASK
InputEvent
modifiers.x
- the x coordinate of the native pointer.y
- the y coordinate of the native pointer.clickCount
- the number of button clicks associated with this event.public NativeMouseEvent(int id, int modifiers, int x, int y, int clickCount, int button)
NativeMouseEvent
object.id
- an integer that identifies the native event type.modifiers
- a modifier mask describing the modifier keys and mouse
buttons active for the event.
NativeInputEvent
_MASK modifiers should be used as they are
not compatible with the extended _DOWN_MASK or the old _MASK
InputEvent
modifiers.x
- the x coordinate of the native pointer.y
- the y coordinate of the native pointer.clickCount
- the number of button clicks associated with this event.button
- The mouse buttons that have changed state. NOBUTTON,
BUTTON1, BUTTON2, BUTTON3, BUTTON5 or BUTTON5.public int getButton()
NOBUTTON
,
BUTTON1
,
BUTTON2
,
BUTTON3
,
BUTTON4
or
BUTTON5
public int getClickCount()
public Point getPoint()
Point
object containing the x and y coordinates
of the native pointerpublic int getX()
public int getY()
public String paramString()
paramString
in class NativeInputEvent
Copyright © 2006-2017 ${project.vendor}. All Rights Received.