Search this API

y.view
Class Mouse2DEvent

java.lang.Object
  extended by java.util.EventObject
      extended by y.view.Mouse2DEvent
All Implemented Interfaces:
java.io.Serializable

public class Mouse2DEvent
extends java.util.EventObject

Event object that closely resembles MouseEvent, but offers double precision coordinates.

See Also:
Serialized Form
 

Field Summary
static int MOUSE_CLICKED
           
static int MOUSE_DRAGGED
           
static int MOUSE_ENTERED
           
static int MOUSE_EXITED
           
static int MOUSE_MOVED
           
static int MOUSE_PRESSED
           
static int MOUSE_RELEASED
           
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
Mouse2DEvent(java.lang.Object source, double x, double y, java.awt.event.MouseEvent me)
          Constructs an event using the values obtained from the MouseEvent.
Mouse2DEvent(java.lang.Object source, int id, long when, int modifiers, double x, double y, int button, int clickCount, boolean isPopupTrigger)
          Constructs a Mouse2DEvent.
Mouse2DEvent(java.lang.Object source, java.lang.Object dispatcher, double x, double y, java.awt.event.MouseEvent me)
          Constructs an event using the values obtained from the MouseEvent.
Mouse2DEvent(java.lang.Object source, java.lang.Object dispatcher, int id, long when, int modifiers, double x, double y, int button, int clickCount, boolean isPopupTrigger)
          Constructs a Mouse2DEvent.
 
Method Summary
 int getButton()
          The button constant as defined in MouseEvent.getButton().
 int getClickCount()
          The button constant as defined in MouseEvent.getClickCount().
 java.lang.Object getDispatcher()
          Returns the object that constructed and fired the event.
 int getId()
          Returns the id constant for this event.
 int getModifiers()
          The modifiers mask as defined in InputEvent.getModifiersEx()
 long getWhen()
          Returns the time when this event happened.
 double getX()
          Returns the x coordinates of the event.
 double getY()
          Returns the y coordinates of the event.
 boolean isPopupTrigger()
          Whether the event is considered a popup trigger.
 java.lang.String 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
See Also:
Constant Field Values

MOUSE_DRAGGED

public static final int MOUSE_DRAGGED
See Also:
Constant Field Values

MOUSE_RELEASED

public static final int MOUSE_RELEASED
See Also:
Constant Field Values

MOUSE_CLICKED

public static final int MOUSE_CLICKED
See Also:
Constant Field Values

MOUSE_ENTERED

public static final int MOUSE_ENTERED
See Also:
Constant Field Values

MOUSE_EXITED

public static final int MOUSE_EXITED
See Also:
Constant Field Values

MOUSE_MOVED

public static final int MOUSE_MOVED
See Also:
Constant Field Values
Constructor Detail

Mouse2DEvent

public Mouse2DEvent(java.lang.Object source,
                    int id,
                    long when,
                    int modifiers,
                    double x,
                    double y,
                    int button,
                    int clickCount,
                    boolean isPopupTrigger)
Constructs a Mouse2DEvent. Invoking this constructor is equivalent to:
new Mouse2DEvent(source, null, id, when, modifiers, x, y, button, clickCount, isPopupTrigger)

Parameters:
source - The object on which the Event initially occurred.
id - the type of the event
when - the time when the event occurred
modifiers - the modifiers mask
x - the x coordinate in world coordinates
y - the x coordinate in world coordinates
button - the button mask
clickCount - the number of clicks
isPopupTrigger - whether the event was a popup trigger

Mouse2DEvent

public Mouse2DEvent(java.lang.Object source,
                    java.lang.Object dispatcher,
                    int id,
                    long when,
                    int modifiers,
                    double x,
                    double y,
                    int button,
                    int clickCount,
                    boolean isPopupTrigger)
Constructs a Mouse2DEvent.

Parameters:
source - The object on which the Event initially occurred.
dispatcher - The object that constructed and fired the event. Typically a MouseInputMode instance.
id - the type of the event
when - the time when the event occurred
modifiers - the modifiers mask
x - the x coordinate in world coordinates
y - the x coordinate in world coordinates
button - the button mask
clickCount - the number of clicks
isPopupTrigger - whether the event was a popup trigger

Mouse2DEvent

public Mouse2DEvent(java.lang.Object source,
                    double x,
                    double y,
                    java.awt.event.MouseEvent me)
Constructs an event using the values obtained from the MouseEvent. Invoking this constructor is equivalent to:
new Mouse2DEvent(source, null, x, y, me)

Parameters:
source - the source to use for the event
x - the x coordinate in the world coordinate system
y - the y coordinate in the world coordinate system
me - the mouse event to get the other values from

Mouse2DEvent

public Mouse2DEvent(java.lang.Object source,
                    java.lang.Object dispatcher,
                    double x,
                    double y,
                    java.awt.event.MouseEvent me)
Constructs an event using the values obtained from the MouseEvent. Invoking this constructor is equivalent to:
new Mouse2DEvent(source, dispatcher, me.getID(), me.getWhen(), me.getModifiersEx(), x, y, mr.getButton(), me.getClickCount(), me.isPopupTrigger())

Parameters:
source - the source to use for the event
dispatcher - The object that constructed and fired the event. Typically a MouseInputMode instance.
x - the x coordinate in the world coordinate system
y - the y coordinate in the world coordinate system
me - the mouse event to get the other values from
Method Detail

getX

public double getX()
Returns the x coordinates of the event.

Returns:
the x coordinate (in the world coordinate system)

getY

public double getY()
Returns the y coordinates of the event.

Returns:
the y coordinate (in the world coordinate system)

getId

public int getId()
Returns the id constant for this event.

Returns:
one of MOUSE_CLICKED, MOUSE_DRAGGED, MOUSE_PRESSED, MOUSE_RELEASED, MOUSE_ENTERED, MOUSE_EXITED, or MOUSE_MOVED.

getWhen

public long getWhen()
Returns the time when this event happened.

Returns:
the time as obtained from System.currentTimeMillis()

getModifiers

public int getModifiers()
The modifiers mask as defined in InputEvent.getModifiersEx()

Returns:
the modifier mask

getButton

public int getButton()
The button constant as defined in MouseEvent.getButton().

Returns:
the button constant

getClickCount

public int getClickCount()
The button constant as defined in MouseEvent.getClickCount().

Returns:
the number of clicks associated with this event

isPopupTrigger

public boolean isPopupTrigger()
Whether the event is considered a popup trigger.


getDispatcher

public java.lang.Object getDispatcher()
Returns the object that constructed and fired the event. Typically a MouseInputMode instance.

Returns:
the object that constructed and fired the event.

toString

public java.lang.String toString()
Overrides:
toString in class java.util.EventObject

© Copyright 2000-2021,
yWorks GmbH.
All rights reserved.