Class MouseTracker



  • public class MouseTracker
    extends Object
    Tracks the mouse location and button state.
    • Constructor Detail

      • MouseTracker

        public MouseTracker()
    • Method Detail

      • isButtonPressed

        public static boolean isButtonPressed(int buttonMask)
        Return true if the specified button is pressed.
        Parameters:
        buttonMask - a button mask, such as MouseEvent.BUTTON1
        Returns:
        true if that button is pressed
      • isButtonPressed

        public static boolean isButtonPressed()
        Returns:
        true if any button is pressed.
      • getX

        public static int getX()
        Returns:
        the x-coordinate of the mouse location.
      • getY

        public static int getY()
        Returns:
        the y-coordinate of the mouse location.
      • addChangeListener

        public static void addChangeListener(ChangeListener l)
      • removeChangeListener

        public static void removeChangeListener(ChangeListener l)