MouseEvent

processing.event

## Class MouseEvent

- java.lang.Object
- - processing.event.Event
  - - processing.event.MouseEvent

-     public class MouseEvent
      extends Event

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `CLICK`
    `static int` | `DRAG`
    `static int` | `ENTER`
    `static int` | `EXIT`
    `static int` | `MOVE`
    `static int` | `PRESS`
    `static int` | `RELEASE`
    `static int` | `WHEEL`

    - ### Fields inherited from class processing.event.Event

      `ALT, CTRL, KEY, META, MOUSE, SHIFT, TOUCH`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MouseEvent(Object nativeObject, long millis, int action, int modifiers, int x, int y, int button, int count)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `float` | `getAmount()` Deprecated.
    `int` | `getButton()` Which button was pressed, either LEFT, CENTER, or RIGHT.
    `int` | `getClickCount()` Deprecated.
    `int` | `getCount()` Number of clicks for mouse button events, or the number of steps (positive or negative depending on direction) for a mouse wheel event.
    `int` | `getX()`
    `int` | `getY()`

    - ### Methods inherited from class processing.event.Event

      `getAction, getFlavor, getMillis, getModifiers, getNative, isAltDown, isControlDown, isMetaDown, isShiftDown`

    - ### Methods inherited from class java.lang.Object

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

- - ### Field Detail

    - #### PRESS

          public static final int PRESS

      See Also:
        Constant Field Values

    - #### RELEASE

          public static final int RELEASE

      See Also:
        Constant Field Values

    - #### CLICK

          public static final int CLICK

      See Also:
        Constant Field Values

    - #### DRAG

          public static final int DRAG

      See Also:
        Constant Field Values

    - #### MOVE

          public static final int MOVE

      See Also:
        Constant Field Values

    - #### ENTER

          public static final int ENTER

      See Also:
        Constant Field Values

    - #### EXIT

          public static final int EXIT

      See Also:
        Constant Field Values

    - #### WHEEL

          public static final int WHEEL

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### MouseEvent

          public MouseEvent(Object nativeObject,
                    long millis,
                    int action,
                    int modifiers,
                    int x,
                    int y,
                    int button,
                    int count)

  - ### Method Detail

    - #### getX

          public int getX()

    - #### getY

          public int getY()

    - #### getButton

          public int getButton()

      Which button was pressed, either LEFT, CENTER, or RIGHT.

    - #### getClickCount

          @Deprecated
          public int getClickCount()

      Deprecated.
      Do not use, getCount() is the correct method.

    - #### getAmount

          @Deprecated
          public float getAmount()

      Deprecated.
      Do not use, getCount() is the correct method.

    - #### getCount

          public int getCount()

      Number of clicks for mouse button events, or the number of steps (positive or negative depending on direction) for a mouse wheel event. Wheel events follow Java (see here), so getAmount() will return "negative values if the mouse wheel was rotated up or away from the user" and positive values in the other direction. On Mac OS X, this will be reversed when "natural" scrolling is enabled in System Preferences &rarr Mouse.