Class WheelEvent
Event delivered to mouse wheel listeners when the wheel or a trackpad scroll gesture is moved.
The deltas are reported in display pixels (already converted from the native notch count by the
port). A positive deltaY reveals content above (the user scrolled the wheel down), and a
positive deltaX reveals content to the left. Consuming this event with #consume() prevents
the default scrolling behavior, which is useful for gestures such as control plus wheel to zoom.
-
Nested Class Summary
Nested classes/interfaces inherited from class ActionEvent
ActionEvent.Type -
Constructor Summary
ConstructorsConstructorDescriptionWheelEvent(Object source, int x, int y, int deltaX, int deltaY, boolean precise, int modifiers) Creates a new wheel event. -
Method Summary
Modifier and TypeMethodDescriptionintThe horizontal scroll amount in display pixels.intThe vertical scroll amount in display pixels.intA bitmask of the keyboard modifiers held during this event, built from thePointerEventMODIFIER_*constants.booleanTrue if the alt/option key was held during this event.booleanTrue if the control key was held during this event.booleanTrue if the meta/command/windows key was held during this event.booleanTrue if the deltas come from a high resolution device such as a trackpad rather than a notched mouse wheel.booleanTrue if the shift key was held during this event.Methods inherited from class ActionEvent
consume, getActualComponent, getCommand, getComponent, getDraggedComponent, getDropTarget, getEventType, getKeyEvent, getPointerEvent, getProgress, getSource, getX, getY, isConsumed, isLongEvent, isPointerPressedDuringDrag, setPointerEvent, setPointerPressedDuringDrag
-
Constructor Details
-
WheelEvent
public WheelEvent(Object source, int x, int y, int deltaX, int deltaY, boolean precise, int modifiers) Creates a new wheel event.
Parameters
-
source: the component the wheel was moved over -
x: the pointer x position in display pixels -
y: the pointer y position in display pixels -
deltaX: the horizontal scroll amount in display pixels -
deltaY: the vertical scroll amount in display pixels -
precise: true if the deltas come from a high resolution device such as a trackpad -
modifiers: bitmask of thePointerEventMODIFIER_*constants for held keyboard modifiers
-
-
-
Method Details
-
getDeltaX
public int getDeltaX()The horizontal scroll amount in display pixels. A positive value reveals content to the left. -
getDeltaY
public int getDeltaY()The vertical scroll amount in display pixels. A positive value reveals content above. -
isPrecise
public boolean isPrecise()True if the deltas come from a high resolution device such as a trackpad rather than a notched mouse wheel. -
getModifiers
public int getModifiers()A bitmask of the keyboard modifiers held during this event, built from thePointerEventMODIFIER_*constants. -
isShiftDown
public boolean isShiftDown()True if the shift key was held during this event. -
isControlDown
public boolean isControlDown()True if the control key was held during this event. -
isAltDown
public boolean isAltDown()True if the alt/option key was held during this event. -
isMetaDown
public boolean isMetaDown()True if the meta/command/windows key was held during this event.
-