KeyStroke.RealF3
, MouseAction
, ScreenInfoAction
public class KeyStroke extends Object
Use the keyType field to determine what kind of key was pressed. For ordinary letters, numbers and symbols, the keyType will be KeyType.Character and the actual character value of the key is in the character field. Please note that return (\n) and tab (\t) are not sorted under type KeyType.Character but KeyType.Enter and KeyType.Tab instead.
Modifier and Type | Class | Description |
---|---|---|
static class |
KeyStroke.RealF3 |
an F3-KeyStroke that is distinguishable from a CursorLocation report.
|
Constructor | Description |
---|---|
KeyStroke(KeyType keyType) |
Constructs a KeyStroke based on a supplied keyType; character will be null and both ctrl and alt will be
considered not pressed.
|
KeyStroke(KeyType keyType,
boolean ctrlDown,
boolean altDown) |
Constructs a KeyStroke based on a supplied keyType; character will be null.
|
KeyStroke(KeyType keyType,
boolean ctrlDown,
boolean altDown,
boolean shiftDown) |
Constructs a KeyStroke based on a supplied keyType; character will be null.
|
KeyStroke(Character character,
boolean ctrlDown,
boolean altDown) |
Constructs a KeyStroke based on a supplied character, keyType is implicitly KeyType.Character.
|
KeyStroke(Character character,
boolean ctrlDown,
boolean altDown,
boolean shiftDown) |
Constructs a KeyStroke based on a supplied character, keyType is implicitly KeyType.Character.
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
equals(Object obj) |
|
static KeyStroke |
fromString(String keyStr) |
Creates a Key from a string representation in Vim's key notation.
|
Character |
getCharacter() |
For keystrokes of ordinary keys (letters, digits, symbols), this method returns the actual character value of the
key.
|
long |
getEventTime() |
Gets the time when the keystroke was recorded.
|
KeyType |
getKeyType() |
Type of key that was pressed on the keyboard, as represented by the KeyType enum.
|
int |
hashCode() |
|
boolean |
isAltDown() |
|
boolean |
isCtrlDown() |
|
boolean |
isShiftDown() |
|
String |
toString() |
public KeyStroke(KeyType keyType)
keyType
- Type of the key pressed by this keystrokepublic KeyStroke(KeyType keyType, boolean ctrlDown, boolean altDown)
keyType
- Type of the key pressed by this keystrokectrlDown
- Was ctrl held down when the main key was pressed?altDown
- Was alt held down when the main key was pressed?public KeyStroke(KeyType keyType, boolean ctrlDown, boolean altDown, boolean shiftDown)
keyType
- Type of the key pressed by this keystrokectrlDown
- Was ctrl held down when the main key was pressed?altDown
- Was alt held down when the main key was pressed?shiftDown
- Was shift held down when the main key was pressed?public KeyStroke(Character character, boolean ctrlDown, boolean altDown)
A character-based KeyStroke does not support the shiftDown flag, as the shift state has already been accounted for in the character itself, depending on user's keyboard layout.
character
- Character that was typed on the keyboardctrlDown
- Was ctrl held down when the main key was pressed?altDown
- Was alt held down when the main key was pressed?public KeyStroke(Character character, boolean ctrlDown, boolean altDown, boolean shiftDown)
A character-based KeyStroke does not support the shiftDown flag, as the shift state has already been accounted for in the character itself, depending on user's keyboard layout.
character
- Character that was typed on the keyboardctrlDown
- Was ctrl held down when the main key was pressed?altDown
- Was alt held down when the main key was pressed?shiftDown
- Was shift held down when the main key was pressed?public KeyType getKeyType()
public Character getCharacter()
public boolean isCtrlDown()
public boolean isAltDown()
public boolean isShiftDown()
public long getEventTime()
Copyright © 2020. All rights reserved.