# Class WheelEvent

java.lang.Object
com.codename1.ui.events.ActionEvent
com.codename1.ui.events.WheelEvent

public class WheelEvent extends ActionEvent

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

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

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `getDeltaX()`
  The horizontal scroll amount in display pixels.
  `int`
  `getDeltaY()`
  The vertical scroll amount in display pixels.
  `int`
  `getModifiers()`
  A bitmask of the keyboard modifiers held during this event, built from the `PointerEvent` `MODIFIER_*` constants.
  `boolean`
  `isAltDown()`
  True if the alt/option key was held during this event.
  `boolean`
  `isControlDown()`
  True if the control key was held during this event.
  `boolean`
  `isMetaDown()`
  True if the meta/command/windows key was held during this event.
  `boolean`
  `isPrecise()`
  True if the deltas come from a high resolution device such as a trackpad rather than a notched mouse wheel.
  `boolean`
  `isShiftDown()`
  True 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`

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 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 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.