Class NativeMouseWheelEvent
- All Implemented Interfaces:
Serializable
A NativeMouseWheelEvent object is passed to every
NativeMouseWheelListener object which is registered to receive
mouse wheel events using the GlobalScreen.addNativeMouseWheelListener(NativeMouseWheelListener)
method. The GlobalScreen object then dispatches a
NativeMouseWheelEvent to each listener.
Platforms offer customization of the amount of scrolling that should take place when the mouse
wheel is moved. The two most common settings are to scroll a certain number of "units" (commonly
lines of text in a text-based component) or an entire "block" (similar to page-up/page-down).
The
NativeMouseWheelEvent offers methods for conforming to the
underlying platform settings. These platform settings can be changed at any time by the user.
NativeMouseWheelEvents reflect the most recent settings.
- Since:
- 1.1
- Version:
- 2.0
- Author:
- Alexander Barker (alex@1stleg.com)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intConstant representing scrolling by a "block" (like scrolling with page-up, page-down keys).static final intConstant representing scrolling in the horizontal direction.static final intConstant representing scrolling by "units" (like scrolling with the arrow keys).static final intConstant representing scrolling in the vertical direction.Fields inherited from class com.github.kwhat.jnativehook.mouse.NativeMouseEvent
BUTTON1, BUTTON2, BUTTON3, BUTTON4, BUTTON5, NATIVE_MOUSE_CLICKED, NATIVE_MOUSE_DRAGGED, NATIVE_MOUSE_FIRST, NATIVE_MOUSE_LAST, NATIVE_MOUSE_MOVED, NATIVE_MOUSE_PRESSED, NATIVE_MOUSE_RELEASED, NATIVE_MOUSE_WHEEL, NOBUTTONFields inherited from class com.github.kwhat.jnativehook.NativeInputEvent
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_MASKFields inherited from class java.util.EventObject
source -
Constructor Summary
ConstructorsConstructorDescriptionNativeMouseWheelEvent(int id, int modifiers, int x, int y, int clickCount, int scrollType, int scrollAmount, int wheelRotation) Instantiates a newNativeMouseWheelEventobject with a vertical direction.NativeMouseWheelEvent(int id, int modifiers, int x, int y, int clickCount, int scrollType, int scrollAmount, int wheelRotation, int wheelDirection) Instantiates a newNativeMouseWheelEventobject. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the number of units that should be scrolled per click of mouse wheel rotation.intReturns the type of scrolling that should take place in response to this event.intReturns the direction of scrolling that should take place in response to this event.intReturns the number of "clicks" the mouse wheel was rotated.Returns a parameter string identifying the native event.Methods inherited from class com.github.kwhat.jnativehook.mouse.NativeMouseEvent
getButton, getClickCount, getPoint, getX, getYMethods inherited from class com.github.kwhat.jnativehook.NativeInputEvent
getID, getModifiers, getModifiersText, getWhen, setModifiersMethods inherited from class java.util.EventObject
getSource, toString
-
Field Details
-
WHEEL_UNIT_SCROLL
public static final int WHEEL_UNIT_SCROLLConstant representing scrolling by "units" (like scrolling with the arrow keys).- See Also:
-
WHEEL_BLOCK_SCROLL
public static final int WHEEL_BLOCK_SCROLLConstant representing scrolling by a "block" (like scrolling with page-up, page-down keys).- See Also:
-
WHEEL_VERTICAL_DIRECTION
public static final int WHEEL_VERTICAL_DIRECTIONConstant representing scrolling in the vertical direction.- Since:
- 2.1
- See Also:
-
WHEEL_HORIZONTAL_DIRECTION
public static final int WHEEL_HORIZONTAL_DIRECTIONConstant representing scrolling in the horizontal direction.- Since:
- 2.1
- See Also:
-
-
Constructor Details
-
NativeMouseWheelEvent
public NativeMouseWheelEvent(int id, int modifiers, int x, int y, int clickCount, int scrollType, int scrollAmount, int wheelRotation) Instantiates a newNativeMouseWheelEventobject with a vertical direction.- Parameters:
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 _MASKmodifiers should be used as they are not compatible with the extended _DOWN_MASK or the old _MASKInputEventmodifiers.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.scrollType- the type of scrolling which should take place in response to this event; valid values areWHEEL_UNIT_SCROLLandWHEEL_BLOCK_SCROLL.scrollAmount- for scrollTypeWHEEL_UNIT_SCROLL, the number of units to be scrolled.wheelRotation- the amount that the mouse wheel was rotated (the number of "clicks")- See Also:
-
NativeMouseWheelEvent
public NativeMouseWheelEvent(int id, int modifiers, int x, int y, int clickCount, int scrollType, int scrollAmount, int wheelRotation, int wheelDirection) Instantiates a newNativeMouseWheelEventobject.- Parameters:
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 _MASKmodifiers should be used as they are not compatible with the extended _DOWN_MASK or the old _MASKInputEventmodifiers.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.scrollType- the type of scrolling which should take place in response to this event; valid values areWHEEL_UNIT_SCROLLandWHEEL_BLOCK_SCROLL.scrollAmount- for scrollTypeWHEEL_UNIT_SCROLL, the number of units to be scrolled.wheelRotation- the amount that the mouse wheel was rotated (the number of "clicks")wheelDirection- the direction of scrolling which should take place in response to this event; valid values areWHEEL_VERTICAL_DIRECTIONandWHEEL_HORIZONTAL_DIRECTION.- Since:
- 2.1
- See Also:
-
-
Method Details
-
getScrollAmount
public int getScrollAmount()Returns the number of units that should be scrolled per click of mouse wheel rotation. Only valid ifgetScrollTypereturnsNativeMouseWheelEvent.WHEEL_UNIT_SCROLL- Returns:
- number of units to scroll, or an undefined value if
getScrollTypereturnsNativeMouseWheelEvent.WHEEL_BLOCK_SCROLL - See Also:
-
getScrollType
public int getScrollType()Returns the type of scrolling that should take place in response to this event. This is determined by the native platform. Legal values are:- MouseWheelEvent.WHEEL_UNIT_SCROLL
- MouseWheelEvent.WHEEL_BLOCK_SCROLL
- Returns:
- either NativeMouseWheelEvent.WHEEL_UNIT_SCROLL or NativeMouseWheelEvent.WHEEL_BLOCK_SCROLL, , depending on the configuration of the native platform.
- See Also:
-
getWheelRotation
public int getWheelRotation()Returns the number of "clicks" the mouse wheel was rotated.- Returns:
- negative values if the mouse wheel was rotated up/away from the user, and positive values if the mouse wheel was rotated down/ toward(s) the user.
-
getWheelDirection
public int getWheelDirection()Returns the direction of scrolling that should take place in response to this event. Legal values are:- MouseWheelEvent.WHEEL_VERTICAL_DIRECTION
- MouseWheelEvent.WHEEL_HORIZONTAL_DIRECTION
- Returns:
- either NativeMouseWheelEvent.WHEEL_VERTICAL_DIRECTION or NativeMouseWheelEvent.WHEEL_HORIZONTAL_DIRECTION. .
- Since:
- 2.1
-
paramString
Returns a parameter string identifying the native event. This method is useful for event-logging and debugging.- Overrides:
paramStringin classNativeMouseEvent- Returns:
- a string identifying the native event and its attributes.
-