Package org.jline.terminal
Class KeyEvent
java.lang.Object
org.jline.terminal.KeyEvent
Represents a keyboard event in a terminal.
The KeyEvent class encapsulates information about keyboard actions in a terminal, including the type of key pressed, any modifier keys that were held, and the raw sequence that was received from the terminal.
Key events include:
- Character - A printable character was typed
- Arrow - An arrow key was pressed (Up, Down, Left, Right)
- Function - A function key was pressed (F1-F12)
- Special - A special key was pressed (Enter, Tab, Escape, etc.)
- Unknown - An unrecognized key sequence
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDefines arrow key directions.static enumDefines modifier keys that can be held during a key event.static enumDefines special keys.static enumDefines the types of key events that can occur. -
Constructor Summary
ConstructorsConstructorDescriptionKeyEvent(char character, EnumSet<KeyEvent.Modifier> modifiers, String rawSequence) Creates a character key event.KeyEvent(int functionKey, EnumSet<KeyEvent.Modifier> modifiers, String rawSequence) Creates a function key event.Creates an unknown key event.KeyEvent(KeyEvent.Arrow arrow, EnumSet<KeyEvent.Modifier> modifiers, String rawSequence) Creates an arrow key event.KeyEvent(KeyEvent.Special special, EnumSet<KeyEvent.Modifier> modifiers, String rawSequence) Creates a special key event. -
Method Summary
Modifier and TypeMethodDescriptiongetArrow()charintgetType()booleanhasModifier(KeyEvent.Modifier modifier) toString()
-
Constructor Details
-
KeyEvent
Creates a character key event. -
KeyEvent
Creates an arrow key event. -
KeyEvent
Creates a special key event. -
KeyEvent
Creates a function key event. -
KeyEvent
Creates an unknown key event.
-
-
Method Details
-
getType
-
getCharacter
public char getCharacter() -
getArrow
-
getSpecial
-
getFunctionKey
public int getFunctionKey() -
getModifiers
-
getRawSequence
-
hasModifier
-
toString
-