Class MouseUtils


  • public class MouseUtils
    extends Object
    Helper class for mouse events.
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    • Constructor Detail

      • MouseUtils

        public MouseUtils()
    • Method Detail

      • 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
      • isLeftDown

        public static boolean isLeftDown​(MouseEvent e)
        Checks whether the left mouse button is down. Ctrl/Alt/Shift are allowed.
        Parameters:
        e - the event
        Returns:
        true if left button down
      • 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
      • isMiddleDown

        public static boolean isMiddleDown​(MouseEvent e)
        Checks whether the middle mouse button is down. Ctrl/Alt/Shift are allowed.
        Parameters:
        e - the event
        Returns:
        true if middle/wheel down
      • 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
      • isRightDown

        public static boolean isRightDown​(MouseEvent e)
        Checks whether the right mouse button is down.
        Parameters:
        e - the event
        Returns:
        true if right button down
      • 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