gui.mouse
Class MouseButtonEvent
java.lang.Object
gui.mouse.MouseButtonEvent
public class MouseButtonEvent
- extends java.lang.Object
Static methods for determining whether certain mouse button events have
taken place. This class hides the messiness of checking mouse events on
Mac, where the swing utilities are buggy in JDK1.3.1 but ok in JDK1.4.
With JDK1.3.1:
On a ONE-button Mac:
- ctrl-click and option(alt)-click both answer true to isMiddleButton. I
interpret this as a RIGHT mouse event (pop up menu).
- apple(cloverleaf)-click answers true to isRightButton. I interpret this
as a MIDDLE mouse event (center the display).
On a FIVE-button Mac:
- The right of the middle three buttons answers false to isRightButton and
true to isMiddleButton. I interpret this as a RIGHT mouse event.
- The middle (wheel) button answers false to isRightButton, false to
isMiddleButton, and true to isLeftButton. I don't see any logical way to
make this behave as anything other than a left click (selection), since
the event appears identical to a left click in every aspect I've checked.
- The left of the three middle buttons answers true to isLeftButton. Fine.
- The far-left buttons (on the side of the mouse--buttons I wouldn't
normally use) answer true to isRightButton, false to the others. This
gets treated as MIDDLE button (center the display).
(Although this isn't currently used here, note that Windows responds TRUE to isAltDown when
it's not (and false when it is!) and same with isControlDown.)
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MouseButtonEvent
public MouseButtonEvent()
isLeftMouseClick
public static boolean isLeftMouseClick(java.awt.event.MouseEvent evt)
isMiddleMouseClick
public static boolean isMiddleMouseClick(java.awt.event.MouseEvent evt)
isMiddleMouseClickNoShift
public static boolean isMiddleMouseClickNoShift(java.awt.event.MouseEvent evt)
isRightMouseClick
public static boolean isRightMouseClick(java.awt.event.MouseEvent evt)
isRightMouseClickNoShift
public static boolean isRightMouseClickNoShift(java.awt.event.MouseEvent evt)
isRightMouseClickWithShift
public static boolean isRightMouseClickWithShift(java.awt.event.MouseEvent evt)
isShift
public static boolean isShift(java.awt.event.MouseEvent evt)
- Returns true if shift key is held down
- Parameters:
evt
- mouse event decoded as try if the shift is held
- Returns:
- the mask with the Event.SHIFT_MASK and mouse event