Package jexer
Class TKeypress
- java.lang.Object
-
- jexer.TKeypress
-
public class TKeypress extends java.lang.Object
This class represents keystrokes.
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description TKeypress(boolean isKey, int fnKey, int ch, boolean alt, boolean ctrl, boolean shift)
Public constructor makes an immutable instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TKeypress
dup()
Create a duplicate instance.boolean
equals(java.lang.Object rhs)
Comparison check.boolean
equalsWithoutModifiers(java.lang.Object rhs)
Comparison check, omitting the ctrl/alt/shift flags.int
getChar()
Getter for character.int
getKeyCode()
Getter for function key code.int
hashCode()
Hashcode uses all fields in equals().boolean
isAlt()
Getter for ALT.boolean
isCtrl()
Getter for CTRL.boolean
isFnKey()
Getter for isFunctionKey.boolean
isShift()
Getter for SHIFT.TKeypress
toLowerCase()
Convert a keypress to lowercase.java.lang.String
toString()
Make human-readable description of this TKeypress.TKeypress
toUpperCase()
Convert a keypress to uppercase.
-
-
-
Field Detail
-
NONE
public static final int NONE
"No key".- See Also:
- Constant Field Values
-
F1
public static final int F1
Function key F1.- See Also:
- Constant Field Values
-
F2
public static final int F2
Function key F2.- See Also:
- Constant Field Values
-
F3
public static final int F3
Function key F3.- See Also:
- Constant Field Values
-
F4
public static final int F4
Function key F4.- See Also:
- Constant Field Values
-
F5
public static final int F5
Function key F5.- See Also:
- Constant Field Values
-
F6
public static final int F6
Function key F6.- See Also:
- Constant Field Values
-
F7
public static final int F7
Function key F7.- See Also:
- Constant Field Values
-
F8
public static final int F8
Function key F8.- See Also:
- Constant Field Values
-
F9
public static final int F9
Function key F9.- See Also:
- Constant Field Values
-
F10
public static final int F10
Function key F10.- See Also:
- Constant Field Values
-
F11
public static final int F11
Function key F11.- See Also:
- Constant Field Values
-
F12
public static final int F12
Function key F12.- See Also:
- Constant Field Values
-
HOME
public static final int HOME
Home.- See Also:
- Constant Field Values
-
END
public static final int END
End.- See Also:
- Constant Field Values
-
PGUP
public static final int PGUP
Page up.- See Also:
- Constant Field Values
-
PGDN
public static final int PGDN
Page down.- See Also:
- Constant Field Values
-
INS
public static final int INS
Insert.- See Also:
- Constant Field Values
-
DEL
public static final int DEL
Delete.- See Also:
- Constant Field Values
-
RIGHT
public static final int RIGHT
Right arrow.- See Also:
- Constant Field Values
-
LEFT
public static final int LEFT
Left arrow.- See Also:
- Constant Field Values
-
UP
public static final int UP
Up arrow.- See Also:
- Constant Field Values
-
DOWN
public static final int DOWN
Down arrow.- See Also:
- Constant Field Values
-
TAB
public static final int TAB
Tab.- See Also:
- Constant Field Values
-
BTAB
public static final int BTAB
Back-tab (shift-tab).- See Also:
- Constant Field Values
-
ENTER
public static final int ENTER
Enter.- See Also:
- Constant Field Values
-
ESC
public static final int ESC
Escape.- See Also:
- Constant Field Values
-
BACKSPACE
public static final int BACKSPACE
Backspace, used for control-backspace.- See Also:
- Constant Field Values
-
kbNoKey
public static final TKeypress kbNoKey
-
kbF1
public static final TKeypress kbF1
-
kbF2
public static final TKeypress kbF2
-
kbF3
public static final TKeypress kbF3
-
kbF4
public static final TKeypress kbF4
-
kbF5
public static final TKeypress kbF5
-
kbF6
public static final TKeypress kbF6
-
kbF7
public static final TKeypress kbF7
-
kbF8
public static final TKeypress kbF8
-
kbF9
public static final TKeypress kbF9
-
kbF10
public static final TKeypress kbF10
-
kbF11
public static final TKeypress kbF11
-
kbF12
public static final TKeypress kbF12
-
kbAltF1
public static final TKeypress kbAltF1
-
kbAltF2
public static final TKeypress kbAltF2
-
kbAltF3
public static final TKeypress kbAltF3
-
kbAltF4
public static final TKeypress kbAltF4
-
kbAltF5
public static final TKeypress kbAltF5
-
kbAltF6
public static final TKeypress kbAltF6
-
kbAltF7
public static final TKeypress kbAltF7
-
kbAltF8
public static final TKeypress kbAltF8
-
kbAltF9
public static final TKeypress kbAltF9
-
kbAltF10
public static final TKeypress kbAltF10
-
kbAltF11
public static final TKeypress kbAltF11
-
kbAltF12
public static final TKeypress kbAltF12
-
kbCtrlF1
public static final TKeypress kbCtrlF1
-
kbCtrlF2
public static final TKeypress kbCtrlF2
-
kbCtrlF3
public static final TKeypress kbCtrlF3
-
kbCtrlF4
public static final TKeypress kbCtrlF4
-
kbCtrlF5
public static final TKeypress kbCtrlF5
-
kbCtrlF6
public static final TKeypress kbCtrlF6
-
kbCtrlF7
public static final TKeypress kbCtrlF7
-
kbCtrlF8
public static final TKeypress kbCtrlF8
-
kbCtrlF9
public static final TKeypress kbCtrlF9
-
kbCtrlF10
public static final TKeypress kbCtrlF10
-
kbCtrlF11
public static final TKeypress kbCtrlF11
-
kbCtrlF12
public static final TKeypress kbCtrlF12
-
kbShiftF1
public static final TKeypress kbShiftF1
-
kbShiftF2
public static final TKeypress kbShiftF2
-
kbShiftF3
public static final TKeypress kbShiftF3
-
kbShiftF4
public static final TKeypress kbShiftF4
-
kbShiftF5
public static final TKeypress kbShiftF5
-
kbShiftF6
public static final TKeypress kbShiftF6
-
kbShiftF7
public static final TKeypress kbShiftF7
-
kbShiftF8
public static final TKeypress kbShiftF8
-
kbShiftF9
public static final TKeypress kbShiftF9
-
kbShiftF10
public static final TKeypress kbShiftF10
-
kbShiftF11
public static final TKeypress kbShiftF11
-
kbShiftF12
public static final TKeypress kbShiftF12
-
kbEnter
public static final TKeypress kbEnter
-
kbTab
public static final TKeypress kbTab
-
kbEsc
public static final TKeypress kbEsc
-
kbHome
public static final TKeypress kbHome
-
kbEnd
public static final TKeypress kbEnd
-
kbPgUp
public static final TKeypress kbPgUp
-
kbPgDn
public static final TKeypress kbPgDn
-
kbIns
public static final TKeypress kbIns
-
kbDel
public static final TKeypress kbDel
-
kbUp
public static final TKeypress kbUp
-
kbDown
public static final TKeypress kbDown
-
kbLeft
public static final TKeypress kbLeft
-
kbRight
public static final TKeypress kbRight
-
kbAltEnter
public static final TKeypress kbAltEnter
-
kbAltTab
public static final TKeypress kbAltTab
-
kbAltEsc
public static final TKeypress kbAltEsc
-
kbAltHome
public static final TKeypress kbAltHome
-
kbAltEnd
public static final TKeypress kbAltEnd
-
kbAltPgUp
public static final TKeypress kbAltPgUp
-
kbAltPgDn
public static final TKeypress kbAltPgDn
-
kbAltIns
public static final TKeypress kbAltIns
-
kbAltDel
public static final TKeypress kbAltDel
-
kbAltUp
public static final TKeypress kbAltUp
-
kbAltDown
public static final TKeypress kbAltDown
-
kbAltLeft
public static final TKeypress kbAltLeft
-
kbAltRight
public static final TKeypress kbAltRight
-
kbCtrlEnter
public static final TKeypress kbCtrlEnter
-
kbCtrlTab
public static final TKeypress kbCtrlTab
-
kbCtrlEsc
public static final TKeypress kbCtrlEsc
-
kbCtrlHome
public static final TKeypress kbCtrlHome
-
kbCtrlEnd
public static final TKeypress kbCtrlEnd
-
kbCtrlPgUp
public static final TKeypress kbCtrlPgUp
-
kbCtrlPgDn
public static final TKeypress kbCtrlPgDn
-
kbCtrlIns
public static final TKeypress kbCtrlIns
-
kbCtrlDel
public static final TKeypress kbCtrlDel
-
kbCtrlUp
public static final TKeypress kbCtrlUp
-
kbCtrlDown
public static final TKeypress kbCtrlDown
-
kbCtrlLeft
public static final TKeypress kbCtrlLeft
-
kbCtrlRight
public static final TKeypress kbCtrlRight
-
kbShiftEnter
public static final TKeypress kbShiftEnter
-
kbShiftTab
public static final TKeypress kbShiftTab
-
kbBackTab
public static final TKeypress kbBackTab
-
kbShiftEsc
public static final TKeypress kbShiftEsc
-
kbShiftHome
public static final TKeypress kbShiftHome
-
kbShiftEnd
public static final TKeypress kbShiftEnd
-
kbShiftPgUp
public static final TKeypress kbShiftPgUp
-
kbShiftPgDn
public static final TKeypress kbShiftPgDn
-
kbShiftIns
public static final TKeypress kbShiftIns
-
kbShiftDel
public static final TKeypress kbShiftDel
-
kbShiftUp
public static final TKeypress kbShiftUp
-
kbShiftDown
public static final TKeypress kbShiftDown
-
kbShiftLeft
public static final TKeypress kbShiftLeft
-
kbShiftRight
public static final TKeypress kbShiftRight
-
kbA
public static final TKeypress kbA
-
kbB
public static final TKeypress kbB
-
kbC
public static final TKeypress kbC
-
kbD
public static final TKeypress kbD
-
kbE
public static final TKeypress kbE
-
kbF
public static final TKeypress kbF
-
kbG
public static final TKeypress kbG
-
kbH
public static final TKeypress kbH
-
kbI
public static final TKeypress kbI
-
kbJ
public static final TKeypress kbJ
-
kbK
public static final TKeypress kbK
-
kbL
public static final TKeypress kbL
-
kbM
public static final TKeypress kbM
-
kbN
public static final TKeypress kbN
-
kbO
public static final TKeypress kbO
-
kbP
public static final TKeypress kbP
-
kbQ
public static final TKeypress kbQ
-
kbR
public static final TKeypress kbR
-
kbS
public static final TKeypress kbS
-
kbT
public static final TKeypress kbT
-
kbU
public static final TKeypress kbU
-
kbV
public static final TKeypress kbV
-
kbW
public static final TKeypress kbW
-
kbX
public static final TKeypress kbX
-
kbY
public static final TKeypress kbY
-
kbZ
public static final TKeypress kbZ
-
kbSpace
public static final TKeypress kbSpace
-
kbAltA
public static final TKeypress kbAltA
-
kbAltB
public static final TKeypress kbAltB
-
kbAltC
public static final TKeypress kbAltC
-
kbAltD
public static final TKeypress kbAltD
-
kbAltE
public static final TKeypress kbAltE
-
kbAltF
public static final TKeypress kbAltF
-
kbAltG
public static final TKeypress kbAltG
-
kbAltH
public static final TKeypress kbAltH
-
kbAltI
public static final TKeypress kbAltI
-
kbAltJ
public static final TKeypress kbAltJ
-
kbAltK
public static final TKeypress kbAltK
-
kbAltL
public static final TKeypress kbAltL
-
kbAltM
public static final TKeypress kbAltM
-
kbAltN
public static final TKeypress kbAltN
-
kbAltO
public static final TKeypress kbAltO
-
kbAltP
public static final TKeypress kbAltP
-
kbAltQ
public static final TKeypress kbAltQ
-
kbAltR
public static final TKeypress kbAltR
-
kbAltS
public static final TKeypress kbAltS
-
kbAltT
public static final TKeypress kbAltT
-
kbAltU
public static final TKeypress kbAltU
-
kbAltV
public static final TKeypress kbAltV
-
kbAltW
public static final TKeypress kbAltW
-
kbAltX
public static final TKeypress kbAltX
-
kbAltY
public static final TKeypress kbAltY
-
kbAltZ
public static final TKeypress kbAltZ
-
kbAlt0
public static final TKeypress kbAlt0
-
kbAlt1
public static final TKeypress kbAlt1
-
kbAlt2
public static final TKeypress kbAlt2
-
kbAlt3
public static final TKeypress kbAlt3
-
kbAlt4
public static final TKeypress kbAlt4
-
kbAlt5
public static final TKeypress kbAlt5
-
kbAlt6
public static final TKeypress kbAlt6
-
kbAlt7
public static final TKeypress kbAlt7
-
kbAlt8
public static final TKeypress kbAlt8
-
kbAlt9
public static final TKeypress kbAlt9
-
kbCtrlA
public static final TKeypress kbCtrlA
-
kbCtrlB
public static final TKeypress kbCtrlB
-
kbCtrlC
public static final TKeypress kbCtrlC
-
kbCtrlD
public static final TKeypress kbCtrlD
-
kbCtrlE
public static final TKeypress kbCtrlE
-
kbCtrlF
public static final TKeypress kbCtrlF
-
kbCtrlG
public static final TKeypress kbCtrlG
-
kbCtrlH
public static final TKeypress kbCtrlH
-
kbCtrlI
public static final TKeypress kbCtrlI
-
kbCtrlJ
public static final TKeypress kbCtrlJ
-
kbCtrlK
public static final TKeypress kbCtrlK
-
kbCtrlL
public static final TKeypress kbCtrlL
-
kbCtrlM
public static final TKeypress kbCtrlM
-
kbCtrlN
public static final TKeypress kbCtrlN
-
kbCtrlO
public static final TKeypress kbCtrlO
-
kbCtrlP
public static final TKeypress kbCtrlP
-
kbCtrlQ
public static final TKeypress kbCtrlQ
-
kbCtrlR
public static final TKeypress kbCtrlR
-
kbCtrlS
public static final TKeypress kbCtrlS
-
kbCtrlT
public static final TKeypress kbCtrlT
-
kbCtrlU
public static final TKeypress kbCtrlU
-
kbCtrlV
public static final TKeypress kbCtrlV
-
kbCtrlW
public static final TKeypress kbCtrlW
-
kbCtrlX
public static final TKeypress kbCtrlX
-
kbCtrlY
public static final TKeypress kbCtrlY
-
kbCtrlZ
public static final TKeypress kbCtrlZ
-
kbAltShiftA
public static final TKeypress kbAltShiftA
-
kbAltShiftB
public static final TKeypress kbAltShiftB
-
kbAltShiftC
public static final TKeypress kbAltShiftC
-
kbAltShiftD
public static final TKeypress kbAltShiftD
-
kbAltShiftE
public static final TKeypress kbAltShiftE
-
kbAltShiftF
public static final TKeypress kbAltShiftF
-
kbAltShiftG
public static final TKeypress kbAltShiftG
-
kbAltShiftH
public static final TKeypress kbAltShiftH
-
kbAltShiftI
public static final TKeypress kbAltShiftI
-
kbAltShiftJ
public static final TKeypress kbAltShiftJ
-
kbAltShiftK
public static final TKeypress kbAltShiftK
-
kbAltShiftL
public static final TKeypress kbAltShiftL
-
kbAltShiftM
public static final TKeypress kbAltShiftM
-
kbAltShiftN
public static final TKeypress kbAltShiftN
-
kbAltShiftO
public static final TKeypress kbAltShiftO
-
kbAltShiftP
public static final TKeypress kbAltShiftP
-
kbAltShiftQ
public static final TKeypress kbAltShiftQ
-
kbAltShiftR
public static final TKeypress kbAltShiftR
-
kbAltShiftS
public static final TKeypress kbAltShiftS
-
kbAltShiftT
public static final TKeypress kbAltShiftT
-
kbAltShiftU
public static final TKeypress kbAltShiftU
-
kbAltShiftV
public static final TKeypress kbAltShiftV
-
kbAltShiftW
public static final TKeypress kbAltShiftW
-
kbAltShiftX
public static final TKeypress kbAltShiftX
-
kbAltShiftY
public static final TKeypress kbAltShiftY
-
kbAltShiftZ
public static final TKeypress kbAltShiftZ
-
kbAltShiftHome
public static final TKeypress kbAltShiftHome
-
kbAltShiftEnd
public static final TKeypress kbAltShiftEnd
-
kbAltShiftPgUp
public static final TKeypress kbAltShiftPgUp
-
kbAltShiftPgDn
public static final TKeypress kbAltShiftPgDn
-
kbAltShiftUp
public static final TKeypress kbAltShiftUp
-
kbAltShiftDown
public static final TKeypress kbAltShiftDown
-
kbAltShiftLeft
public static final TKeypress kbAltShiftLeft
-
kbAltShiftRight
public static final TKeypress kbAltShiftRight
-
kbCtrlShiftHome
public static final TKeypress kbCtrlShiftHome
-
kbCtrlShiftEnd
public static final TKeypress kbCtrlShiftEnd
-
kbCtrlShiftPgUp
public static final TKeypress kbCtrlShiftPgUp
-
kbCtrlShiftPgDn
public static final TKeypress kbCtrlShiftPgDn
-
kbCtrlShiftUp
public static final TKeypress kbCtrlShiftUp
-
kbCtrlShiftDown
public static final TKeypress kbCtrlShiftDown
-
kbCtrlShiftLeft
public static final TKeypress kbCtrlShiftLeft
-
kbCtrlShiftRight
public static final TKeypress kbCtrlShiftRight
-
kbBackspace
public static final TKeypress kbBackspace
Backspace as ^H.
-
kbCtrlBackspace
public static final TKeypress kbCtrlBackspace
Control-Backspace as function key.
-
kbAltBackspace
public static final TKeypress kbAltBackspace
Alt-Backspace as function key.
-
kbBackspaceDel
public static final TKeypress kbBackspaceDel
Backspace as ^?.
-
-
Constructor Detail
-
TKeypress
public TKeypress(boolean isKey, int fnKey, int ch, boolean alt, boolean ctrl, boolean shift)
Public constructor makes an immutable instance.- Parameters:
isKey
- is true, this is a function keyfnKey
- the function key code (only valid if isKey is true)ch
- the character (only valid if fnKey is false)alt
- if true, ALT was pressed with this keystrokectrl
- if true, CTRL was pressed with this keystrokeshift
- if true, SHIFT was pressed with this keystroke
-
-
Method Detail
-
isFnKey
public boolean isFnKey()
Getter for isFunctionKey.- Returns:
- if true, ch is meaningless, use keyCode instead
-
getKeyCode
public int getKeyCode()
Getter for function key code.- Returns:
- function key code int value (only valid is isKey is true)
-
isAlt
public boolean isAlt()
Getter for ALT.- Returns:
- alt value
-
isCtrl
public boolean isCtrl()
Getter for CTRL.- Returns:
- ctrl value
-
isShift
public boolean isShift()
Getter for SHIFT.- Returns:
- shift value
-
getChar
public int getChar()
Getter for character.- Returns:
- the character (only valid if isKey is false)
-
dup
public TKeypress dup()
Create a duplicate instance.- Returns:
- duplicate intance
-
equals
public boolean equals(java.lang.Object rhs)
Comparison check. All fields must match to return true.- Overrides:
equals
in classjava.lang.Object
- Parameters:
rhs
- another TKeypress instance- Returns:
- true if all fields are equal
-
equalsWithoutModifiers
public boolean equalsWithoutModifiers(java.lang.Object rhs)
Comparison check, omitting the ctrl/alt/shift flags.- Parameters:
rhs
- another TKeypress instance- Returns:
- true if all fields (except for ctrl/alt/shift) are equal
-
hashCode
public int hashCode()
Hashcode uses all fields in equals().- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- the hash
-
toString
public java.lang.String toString()
Make human-readable description of this TKeypress.- Overrides:
toString
in classjava.lang.Object
- Returns:
- displayable String
-
toLowerCase
public TKeypress toLowerCase()
Convert a keypress to lowercase. Function keys and alt/ctrl keys are not converted.- Returns:
- a new instance with the key converted
-
toUpperCase
public TKeypress toUpperCase()
Convert a keypress to uppercase. Function keys and alt/ctrl keys are not converted.- Returns:
- a new instance with the key converted
-
-