- 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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.googlecode.lanterna.input.KeyStroke
KeyStroke.RealF3
-
-
Field Summary
Fields Modifier and Type Field Description private MouseActionType
actionType
private int
button
private TerminalPosition
position
-
Constructor Summary
Constructors Constructor Description MouseAction(MouseActionType actionType, int button, TerminalPosition position)
Constructs a MouseAction based on an action type, a button and a location on the screen
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MouseActionType
getActionType()
Returns the mouse action type so the caller can determine which kind of action was performed.int
getButton()
Which button was involved in this event.TerminalPosition
getPosition()
The location of the mouse cursor when this event was generated.boolean
isMouseDown()
boolean
isMouseDrag()
boolean
isMouseMove()
boolean
isMouseUp()
java.lang.String
toString()
-
Methods inherited from class com.googlecode.lanterna.input.KeyStroke
equals, fromString, getCharacter, getEventTime, getKeyType, hashCode, isAltDown, isCtrlDown, isShiftDown
-
-
-
-
Field Detail
-
actionType
private final MouseActionType actionType
-
button
private final int button
-
position
private final TerminalPosition position
-
-
Constructor Detail
-
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 eventbutton
- 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 Detail
-
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()
-
-