Class MouseUtils

java.lang.Object
nz.ac.waikato.cms.gui.core.MouseUtils

public class MouseUtils extends Object
Helper class for mouse events.
Version:
$Revision: 14478 $
Author:
fracpete (fracpete at waikato dot ac dot nz)
  • Constructor Details

    • MouseUtils

      public MouseUtils()
  • Method Details

    • isLeftClick

      public static boolean isLeftClick(MouseEvent e)
      Checks whether the mouse event is a left-click event. Ctrl/Alt/Shift are allowed.
      Parameters:
      e - the event
      Returns:
      true if a left-click event
    • isDoubleClick

      public static boolean isDoubleClick(MouseEvent e)
      Checks whether the mouse event is a double-click event (with the left mouse button). Ctrl/Alt/Shift are allowed.
      Parameters:
      e - the event
      Returns:
      true if a double-click event
    • isMiddleClick

      public static boolean isMiddleClick(MouseEvent e)
      Checks whether the mouse event is a middle/wheel-click event. Ctrl/Alt/Shift are allowed.
      Parameters:
      e - the event
      Returns:
      true if a middle/wheel-click event
    • isRightClick

      public static boolean isRightClick(MouseEvent e)
      Checks whether the mouse event is a right-click event. Alt+Left-Click is also interpreted as right-click.
      Parameters:
      e - the event
      Returns:
      true if a right-click event
    • isPrintScreenClick

      public static boolean isPrintScreenClick(MouseEvent e)
      Checks whether the mouse event is a "print screen" event: Alt+Shift+Left-Click.
      Parameters:
      e - the event
      Returns:
      true if a "print screen" event
    • hasNoModifierKey

      public static boolean hasNoModifierKey(MouseEvent e)
      Checks whether no modified key is pressed.
      Parameters:
      e - the event
      Returns:
      true if no modifier key pressed
    • setWaitCursor

      public static void setWaitCursor(Component comp)
      Sets the wait cursor for the specified component.
      Parameters:
      comp - the component to update
    • setDefaultCursor

      public static void setDefaultCursor(Component comp)
      Sets the default cursor for the specified component.
      Parameters:
      comp - the component to update