Class MouseHandler

java.lang.Object
games.stendhal.client.gui.MouseHandler
All Implemented Interfaces:
MouseListener, MouseMotionListener, EventListener
Direct Known Subclasses:
GroundContainerMouseState

public abstract class MouseHandler extends Object implements MouseListener, MouseMotionListener
Sane mouse handling for components that want to implement drag and drop or pass mouse events to EntityViews.
  • Constructor Details

    • MouseHandler

      public MouseHandler()
  • Method Details

    • onMouseClick

      protected abstract boolean onMouseClick(Point point)
      Called on left mouse single click.
      Parameters:
      point - location
      Returns:
      true if the click was handled
    • onMouseDoubleClick

      protected abstract boolean onMouseDoubleClick(Point point)
      Called on left double click.
      Parameters:
      point - location
      Returns:
      true if the click was handled
    • onMouseRightClick

      protected abstract void onMouseRightClick(Point point)
      Called on right mouse single click.
      Parameters:
      point - location
    • onDragStart

      protected abstract void onDragStart(Point point)
      Called when mouse dragging starts.
      Parameters:
      point - location
    • mouseClicked

      public void mouseClicked(MouseEvent e)
      Java's official mouseClick handler; we don't use this because it doesn't register clicks while the mouse is moving at all.
      Specified by:
      mouseClicked in interface MouseListener
      Parameters:
      e -
    • mouseEntered

      public void mouseEntered(MouseEvent e)
      Specified by:
      mouseEntered in interface MouseListener
    • mouseExited

      public void mouseExited(MouseEvent e)
      Specified by:
      mouseExited in interface MouseListener
    • mousePressed

      public void mousePressed(MouseEvent e)
      Specified by:
      mousePressed in interface MouseListener
    • mouseReleased

      public void mouseReleased(MouseEvent e)
      Specified by:
      mouseReleased in interface MouseListener
    • mouseDragged

      public void mouseDragged(MouseEvent e)
      Specified by:
      mouseDragged in interface MouseMotionListener
    • mouseMoved

      public void mouseMoved(MouseEvent arg0)
      Specified by:
      mouseMoved in interface MouseMotionListener
    • isCtrlDown

      protected boolean isCtrlDown()
      Check if the control key was down during the mouse event.
      Returns:
      true if the control key was down
    • isShiftDown

      protected boolean isShiftDown()
      Check if the shift key was down during the mouse event.
      Returns:
      true if the shift key was down