com.jmex.bui.event
Class MouseEvent

java.lang.Object
  extended by java.util.EventObject
      extended by com.jmex.bui.event.BEvent
          extended by com.jmex.bui.event.InputEvent
              extended by com.jmex.bui.event.MouseEvent
All Implemented Interfaces:
java.io.Serializable

public class MouseEvent
extends InputEvent

Encapsulates the information associated with a mouse event.

See Also:
Serialized Form

Field Summary
protected  int _button
           
protected  int _delta
           
protected  int _mx
           
protected  int _my
           
protected  int _type
           
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 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.jmex.bui.event.InputEvent
_modifiers, ALT_DOWN_MASK, BUTTON1_DOWN_MASK, BUTTON2_DOWN_MASK, BUTTON3_DOWN_MASK, CTRL_DOWN_MASK, META_DOWN_MASK, SHIFT_DOWN_MASK
 
Fields inherited from class com.jmex.bui.event.BEvent
_when
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
MouseEvent(java.lang.Object source, long when, int modifiers, int type, int mx, int my)
           
MouseEvent(java.lang.Object source, long when, int modifiers, int type, int button, int mx, int my)
           
MouseEvent(java.lang.Object source, long when, int modifiers, int type, int button, int mx, int my, 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 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.
protected  void toString(java.lang.StringBuffer buf)
           
 
Methods inherited from class com.jmex.bui.event.InputEvent
getModifiers
 
Methods inherited from class com.jmex.bui.event.BEvent
getWhen, propagateUpHierarchy, toString
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, 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_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

_type

protected int _type

_button

protected int _button

_mx

protected int _mx

_my

protected int _my

_delta

protected int _delta
Constructor Detail

MouseEvent

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

MouseEvent

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

MouseEvent

public MouseEvent(java.lang.Object source,
                  long when,
                  int modifiers,
                  int type,
                  int button,
                  int mx,
                  int my,
                  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.


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: BEvent
Instructs this event to notify the supplied listener if they implement an interface appropriate to this event.

Overrides:
dispatch in class BEvent

toString

protected void toString(java.lang.StringBuffer buf)
Overrides:
toString in class InputEvent


Copyright © 2011 Michael Bayne. All Rights Reserved.