Class MouseAction

java.lang.Object
com.googlecode.lanterna.input.KeyStroke
com.googlecode.lanterna.input.MouseAction

public class MouseAction extends KeyStroke
MouseAction, a KeyStroke in disguise, this class contains the information of a single mouse action event.
  • Field Details

  • Constructor Details

    • MouseAction

      public MouseAction(MouseActionType actionType, int button, TerminalPosition position)
      Constructs a MouseAction based on an action type, a button and a location on the screen
      Parameters:
      actionType - The kind of mouse event
      button - Which button is involved (no button = 0, left button = 1, middle (wheel) button = 2, right button = 3, scroll wheel up = 4, scroll wheel down = 5)
      position - Where in the terminal is the mouse cursor located
  • Method Details

    • getActionType

      public MouseActionType getActionType()
      Returns the mouse action type so the caller can determine which kind of action was performed.
      Returns:
      The action type of the mouse event
    • getButton

      public int getButton()
      Which button was involved in this event. Please note that for CLICK_RELEASE events, there is no button information available (getButton() will return 0). The standard xterm mapping is:
      • No button = 0
      • Left button = 1
      • Middle (wheel) button = 2
      • Right button = 3
      • Wheel up = 4
      • Wheel down = 5
      Returns:
      The button which is clicked down when this event was generated
    • getPosition

      public TerminalPosition getPosition()
      The location of the mouse cursor when this event was generated.
      Returns:
      Location of the mouse cursor
    • isMouseDown

      public boolean isMouseDown()
    • isMouseDrag

      public boolean isMouseDrag()
    • isMouseMove

      public boolean isMouseMove()
    • isMouseUp

      public boolean isMouseUp()
    • toString

      public String toString()
      Overrides:
      toString in class KeyStroke