http://www.jpicedt.org

jpicedt.graphic.event
Class PEMouseEvent

java.lang.Object
  extended by java.util.EventObject
      extended by jpicedt.graphic.event.PEMouseEvent
All Implemented Interfaces:
Serializable

public class PEMouseEvent
extends EventObject

This is an enriched implementation of MouseEvent that return mouse coordinates in model-coordinates in addition to the usual screen-coordinates.

Since:
jpicedt 1.3.2
Version:
$Id: PEMouseEvent.java,v 1.13 2013/03/27 07:06:27 vincentb1 Exp $
Author:
Sylvain Reynal
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
PEMouseEvent(MouseEvent awtEvent, PECanvas source, PicPoint pt)
           
 
Method Summary
 boolean checkModifiersEx(int onMask, int offMask)
          Convenience method to test the state of all modal keys and mouse buttons just after the mouse event occured.
 MouseEvent getAwtMouseEvent()
           
 PECanvas getCanvas()
          Return the PECanvas on which this mouse event occured
 int getClickCount()
           
 int getModifiers()
          Return the modifiers flag for this mouse event
 int getModifiersEx()
          Return the modifiers flag for this mouse event
 PicPoint getPicPoint()
           
 double getX()
          Return the x-coordinate of the mouse click point in model-coordinate.
 double getY()
          Return the y-coordinate of the mouse click point in model-coordinate.
 boolean isAltDown()
          Return whether or not the ALT modifier is down on this mouse event
 boolean isAltGraphDown()
          Return whether or not the "AltGr" modifier is down on this mouse event
 boolean isControlDown()
          Return whether or not the CTRL modifier is down on this mouse event
 boolean isLeftButton()
          Return whether or not the Left button was pressed
 boolean isMetaDown()
          Return whether or not the META (aka ALT) modifier is down on this mouse event
 boolean isMiddleButton()
          Return whether or not the Middle button was pressed ([pending] what happens on MacOS ?)
 boolean isPopupTrigger()
           
 boolean isRightButton()
          Return whether or not the Right button was pressed
 boolean isShiftDown()
          Return whether or not the SHIFT modifier is down on this mouse event
 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
 

Constructor Detail

PEMouseEvent

public PEMouseEvent(MouseEvent awtEvent,
                    PECanvas source,
                    PicPoint pt)
Parameters:
awtEvent - the "standard" MouseEvent, as generated by Component's processMouseXXXEvent method.
source - This constrains PEMouseEvent's to be generated by PEMouseListener's attached to PECanvas's only. This indeed is the only event source that makes sense with this kind of events (notably because we need the zoom factor at some point).
pt - coordinates of click point in model-coordinate system
Method Detail

getAwtMouseEvent

public MouseEvent getAwtMouseEvent()
Returns:
the "standard" MouseEvent wrapped in this PEMouseEvent ; this may be used to retrieve the MouseEvent's fields not accessible through PEMouseEvent's methods.

getCanvas

public PECanvas getCanvas()
Return the PECanvas on which this mouse event occured


getX

public double getX()
Return the x-coordinate of the mouse click point in model-coordinate.


getY

public double getY()
Return the y-coordinate of the mouse click point in model-coordinate.


getPicPoint

public PicPoint getPicPoint()
Returns:
the coordinates of the mouse click point in model-coordinate ; returned value is NOT guaranteed to remain unchaged over time ! Make a copy if you need an immutable value (e.g. using new PicPoint(pt)).

getClickCount

public int getClickCount()
Returns:
the number of mouse clicks associated with this event

getModifiers

public int getModifiers()
Return the modifiers flag for this mouse event

See Also:
InputEvent

getModifiersEx

public int getModifiersEx()
Return the modifiers flag for this mouse event

See Also:
InputEvent

checkModifiersEx

public boolean checkModifiersEx(int onMask,
                                int offMask)
Convenience method to test the state of all modal keys and mouse buttons just after the mouse event occured. Mask are made of InputEvent's mask OR'ed together

Parameters:
onMask - keys/buttons which must be on, e.g. SHIFT_DOWN_MASK | BUTTON1_DOWN_MASK
offMask - keys/buttons which must be off, e.g. CTRL_DOWN_MASK | ALT_DOWN_MASK
See Also:
(extended modifiers masks have been introduced starting from JDK1.4)

isAltDown

public boolean isAltDown()
Return whether or not the ALT modifier is down on this mouse event


isAltGraphDown

public boolean isAltGraphDown()
Return whether or not the "AltGr" modifier is down on this mouse event


isControlDown

public boolean isControlDown()
Return whether or not the CTRL modifier is down on this mouse event


isMetaDown

public boolean isMetaDown()
Return whether or not the META (aka ALT) modifier is down on this mouse event


isShiftDown

public boolean isShiftDown()
Return whether or not the SHIFT modifier is down on this mouse event


isLeftButton

public boolean isLeftButton()
Return whether or not the Left button was pressed


isMiddleButton

public boolean isMiddleButton()
Return whether or not the Middle button was pressed ([pending] what happens on MacOS ?)


isRightButton

public boolean isRightButton()
Return whether or not the Right button was pressed


isPopupTrigger

public boolean isPopupTrigger()
Returns:
whether or not this mouse event is the popup-menu trigger event

toString

public String toString()
Overrides:
toString in class EventObject

http://www.jpicedt.org

Submit a bug : syd@jpicedt.org