Package jpicedt.graphic.event
Class PEMouseEvent
- java.lang.Object
-
- java.util.EventObject
-
- jpicedt.graphic.event.PEMouseEvent
-
- All Implemented Interfaces:
java.io.Serializable
public class PEMouseEvent extends java.util.EventObjectThis 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.8.2.1 2007/09/02 11:56:18 reynal Exp $
- Author:
- Sylvain Reynal
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PEMouseEvent(java.awt.event.MouseEvent awtEvent, PECanvas source, PicPoint pt)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckModifiersEx(int onMask, int offMask)Convenience method to test the state of all modal keys and mouse buttons just after the mouse event occured.java.awt.event.MouseEventgetAwtMouseEvent()Return the "standard" MouseEvent wrapped in this PEMouseEvent ; this may be used to retrieve the MouseEvent's fields not accessible through PEMouseEvent's methods.PECanvasgetCanvas()Return the PECanvas on which this mouse event occuredintgetClickCount()Return the number of mouse clicks associated with this eventintgetModifiers()Return the modifiers flag for this mouse eventintgetModifiersEx()Return the modifiers flag for this mouse eventPicPointgetPicPoint()Return 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.doublegetX()Return the x-coordinate of the mouse click point in model-coordinate.doublegetY()Return the y-coordinate of the mouse click point in model-coordinate.booleanisAltDown()Return whether or not the ALT modifier is down on this mouse eventbooleanisAltGraphDown()Return whether or not the "AltGr" modifier is down on this mouse eventbooleanisControlDown()Return whether or not the CTRL modifier is down on this mouse eventbooleanisLeftButton()Return whether or not the Left button was pressedbooleanisMetaDown()Return whether or not the META (aka ALT) modifier is down on this mouse eventbooleanisMiddleButton()Return whether or not the Middle button was pressed ([pending] what happens on MacOS ?)booleanisPopupTrigger()Return whether or not this mouse event is the popup-menu trigger eventbooleanisRightButton()Return whether or not the Right button was pressedbooleanisShiftDown()Return whether or not the SHIFT modifier is down on this mouse eventjava.lang.StringtoString()
-
-
-
Constructor Detail
-
PEMouseEvent
public PEMouseEvent(java.awt.event.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).coordinates- of click point in model-coordinate system
-
-
Method Detail
-
getAwtMouseEvent
public java.awt.event.MouseEvent getAwtMouseEvent()
Return 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()
Return 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()
Return 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_MASKoffMask- 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()
Return whether or not this mouse event is the popup-menu trigger event
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.util.EventObject
-
-