Class PEMouseEvent

  • All Implemented Interfaces:
    java.io.Serializable

    public class PEMouseEvent
    extends java.util.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.8.2.1 2007/09/02 11:56:18 reynal Exp $
    Author:
    Sylvain Reynal
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class java.util.EventObject

        source
    • 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
      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.
      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.
      PECanvas getCanvas()
      Return the PECanvas on which this mouse event occured
      int getClickCount()
      Return the number of mouse clicks associated with this event
      int getModifiers()
      Return the modifiers flag for this mouse event
      int getModifiersEx()
      Return the modifiers flag for this mouse event
      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.
      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()
      Return whether or not this mouse event is the popup-menu trigger event
      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
      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
    • 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_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()
        Return whether or not this mouse event is the popup-menu trigger event
      • toString

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