public class WheelEvent

  1. Object
  2. ActionEvent
  3. 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.

Constructors

public WheelEvent(Object source, int x, int y, int deltaX, int deltaY, boolean precise, int modifiers)Creates a new wheel event.

Methods

public int getDeltaX()The horizontal scroll amount in display pixels.
public int getDeltaY()The vertical scroll amount in display pixels.
public boolean isPrecise()True if the deltas come from a high resolution device such as a trackpad rather than a notched mouse wheel.
public int getModifiers()A bitmask of the keyboard modifiers held during this event, built from the PointerEvent MODIFIER_* constants.
public boolean isShiftDown()True if the shift key was held during this event.
public boolean isControlDown()True if the control key was held during this event.
public boolean isAltDown()True if the alt/option key was held during this event.
public boolean isMetaDown()True if the meta/command/windows key was held during this event.

Inherited nested types

Inherited methods

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 Object
the component the wheel was moved over
x int
the pointer x position in display pixels
y int
the pointer y position in display pixels
deltaX int
the horizontal scroll amount in display pixels
deltaY int
the vertical scroll amount in display pixels
precise boolean
true if the deltas come from a high resolution device such as a trackpad
modifiers int
bitmask of the PointerEvent MODIFIER_* 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 the PointerEvent MODIFIER_* 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.