com.threerings.opengl.gui.event
Class MouseEvent

java.lang.Object
  extended by java.util.EventObject
      extended by com.threerings.opengl.gui.event.Event
          extended by com.threerings.opengl.gui.event.InputEvent
              extended by com.threerings.opengl.gui.event.MouseEvent
All Implemented Interfaces:
Serializable

public class MouseEvent
extends InputEvent

Encapsulates the information associated with a mouse event.

See Also:
Serialized Form

Field Summary
static int BUTTON1
          A constant representing the "left" mouse button.
static int BUTTON2
          A constant representing the "right" mouse button.
static int BUTTON3
          A constant representing the middle mouse button.
static int BUTTON4
          A constant representing the 4th mouse button.
static int BUTTON5
          A constant representing the 5th mouse button.
static int MOUSE_CLICKED
          An event generated when a mouse button is clicked.
static int MOUSE_DRAGGED
          An event generated when the mouse is dragged.
static int MOUSE_ENTERED
          An event generated when the mouse enters a component's bounds.
static int MOUSE_EXITED
          An event generated when the mouse exits a component's bounds.
static int MOUSE_MOVED
          An event generated when the mouse is moved.
static int MOUSE_PRESSED
          An event generated when a mouse button is pressed.
static int MOUSE_RELEASED
          An event generated when a mouse button is released.
static int MOUSE_WHEELED
          An event generated when the mouse wheel was rotated.
 
Fields inherited from class com.threerings.opengl.gui.event.InputEvent
ALT_DOWN_MASK, BUTTON1_DOWN_MASK, BUTTON2_DOWN_MASK, BUTTON3_DOWN_MASK, CTRL_DOWN_MASK, META_DOWN_MASK, SHIFT_DOWN_MASK
 
Constructor Summary
MouseEvent(Object source, long when, int modifiers, int type, int mx, int my)
           
MouseEvent(Object source, long when, int modifiers, int type, int button, int mx, int my)
           
MouseEvent(Object source, long when, int modifiers, int type, int button, int mx, int my, int ccount)
           
MouseEvent(Object source, long when, int modifiers, int type, int button, int mx, int my, int ccount, int delta)
           
 
Method Summary
 void dispatch(ComponentListener listener)
          Instructs this event to notify the supplied listener if they implement an interface appropriate to this event.
 int getButton()
          Returns the index of the button pertaining to this event (BUTTON1, BUTTON2, or BUTTON3) or -1 if this is not a button related event.
 int getClickCount()
          Returns the click count of the event.
 int getDelta()
          For mouse wheel events this indicates the delta by which the wheel was moved.
 int getType()
          Returns the type of this event, one of MOUSE_PRESSED, {#link MOUSE_RELEASE}, etc.
 int getX()
          Returns the (absolute) x coordinate of the mouse at the time this event was generated.
 int getY()
          Returns the (absolute) y coordinate of the mouse at the time this event was generated.
 
Methods inherited from class com.threerings.opengl.gui.event.InputEvent
getModifiers, isAltDown, isControlDown, isMetaDown, isShiftDown
 
Methods inherited from class com.threerings.opengl.gui.event.Event
consume, getWhen, isConsumed, propagateUpHierarchy, toString
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MOUSE_PRESSED

public static final int MOUSE_PRESSED
An event generated when a mouse button is pressed.

See Also:
Constant Field Values

MOUSE_RELEASED

public static final int MOUSE_RELEASED
An event generated when a mouse button is released.

See Also:
Constant Field Values

MOUSE_CLICKED

public static final int MOUSE_CLICKED
An event generated when a mouse button is clicked.

See Also:
Constant Field Values

MOUSE_ENTERED

public static final int MOUSE_ENTERED
An event generated when the mouse enters a component's bounds.

See Also:
Constant Field Values

MOUSE_EXITED

public static final int MOUSE_EXITED
An event generated when the mouse exits a component's bounds.

See Also:
Constant Field Values

MOUSE_MOVED

public static final int MOUSE_MOVED
An event generated when the mouse is moved.

See Also:
Constant Field Values

MOUSE_DRAGGED

public static final int MOUSE_DRAGGED
An event generated when the mouse is dragged. Drag events are dispatched to the component in which a mouse is clicked and held for all movement until all buttons are released.

See Also:
Constant Field Values

MOUSE_WHEELED

public static final int MOUSE_WHEELED
An event generated when the mouse wheel was rotated.

See Also:
Constant Field Values

BUTTON1

public static final int BUTTON1
A constant representing the "left" mouse button.

See Also:
Constant Field Values

BUTTON2

public static final int BUTTON2
A constant representing the "right" mouse button.

See Also:
Constant Field Values

BUTTON3

public static final int BUTTON3
A constant representing the middle mouse button.

See Also:
Constant Field Values

BUTTON4

public static final int BUTTON4
A constant representing the 4th mouse button.

See Also:
Constant Field Values

BUTTON5

public static final int BUTTON5
A constant representing the 5th mouse button.

See Also:
Constant Field Values
Constructor Detail

MouseEvent

public MouseEvent(Object source,
                  long when,
                  int modifiers,
                  int type,
                  int mx,
                  int my)

MouseEvent

public MouseEvent(Object source,
                  long when,
                  int modifiers,
                  int type,
                  int button,
                  int mx,
                  int my)

MouseEvent

public MouseEvent(Object source,
                  long when,
                  int modifiers,
                  int type,
                  int button,
                  int mx,
                  int my,
                  int ccount)

MouseEvent

public MouseEvent(Object source,
                  long when,
                  int modifiers,
                  int type,
                  int button,
                  int mx,
                  int my,
                  int ccount,
                  int delta)
Method Detail

getType

public int getType()
Returns the type of this event, one of MOUSE_PRESSED, {#link MOUSE_RELEASE}, etc.


getButton

public int getButton()
Returns the index of the button pertaining to this event (BUTTON1, BUTTON2, or BUTTON3) or -1 if this is not a button related event.


getX

public int getX()
Returns the (absolute) x coordinate of the mouse at the time this event was generated.


getY

public int getY()
Returns the (absolute) y coordinate of the mouse at the time this event was generated.


getClickCount

public int getClickCount()
Returns the click count of the event.


getDelta

public int getDelta()
For mouse wheel events this indicates the delta by which the wheel was moved. The units seem to be defined by the underlying OpenGL wrapper, presently LWJGL.


dispatch

public void dispatch(ComponentListener listener)
Description copied from class: Event
Instructs this event to notify the supplied listener if they implement an interface appropriate to this event.

Overrides:
dispatch in class Event


Copyright © 2011. All Rights Reserved.