Class KeyEvent
- All Implemented Interfaces:
Serializable
KeyEvent Delivery
Key events are delivered in the following order:
# | Event Type | Constraints | Notes |
---|---|---|---|
1 | EVENT_KEY_PRESSED | excluding auto-repeat -modifier keys | |
2 | EVENT_KEY_RELEASED | excluding auto-repeat -modifier keys |
Besides regular modifiers like InputEvent.SHIFT_MASK
etc.,
the InputEvent.AUTOREPEAT_MASK
bit is added if repetition is detected, following above constraints.
Auto-Repeat shall behave as follow:
P = pressed, R = released 0 = normal, 1 = auto-repeat P(0), [ R(1), P(1), R(1), ..], R(0)The idea is if you mask out auto-repeat in your event listener you just get one long pressed P/R tuple for
printable
and Action
keys.
Action
keys will produce pressed
and released
events including auto-repeat
.
Printable
keys will produce pressed
and released
events.
Modifier
keys will produce pressed
and released
events
excluding auto-repeat
.
They will also influence subsequent event's modifier
bits while pressed.
Unicode Mapping
Key-chars
, as well as
printable
key-codes
and key-symbols
use the UTF-16 unicode space w/o collision.
Non-printable
key-codes
and key-symbols
,
i.e. modifier-
and action-
keys,
are mapped to unicode's control and private range and do not collide w/ printable
unicode values
with the following exception.
Unicode Collision
The following Key-code
s and key-symbol
s collide w/ unicode space:
unicode range | virtual key code | unicode character |
---|---|---|
[0x61 .. 0x78] | [VK_F1 ..VK_F24 ] | ['a'..'x'] |
Collision was chosen for Key-code
and key-symbol
mapping
to allow a minimal code range, i.e. [0..255]
.
The reduced code range in turn allows the implementation to utilize fast and small lookup tables,
e.g. to implement a key-press state tracker.
http://www.utf8-chartable.de/unicode-utf8-table.pl http://www.unicode.org/Public/5.1.0/ucd/PropList.txt https://en.wikipedia.org/wiki/Mapping_of_Unicode_characters https://en.wikipedia.org/wiki/Unicode_control_characters https://en.wikipedia.org/wiki/Private_Use_%28Unicode%29#Private_Use_Areas
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class com.jogamp.newt.event.InputEvent
InputEvent.InputClass, InputEvent.InputType
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final short
A key has been pressed, excludingauto-repeat
-modifier
keys.static final short
A key has been released, excludingauto-repeat
-modifier
keys.static final KeyEvent.NonPrintableRange[]
Non printable key ranges, currently fixed to an array of size 4.static final char
This value,'\0'
, is used to indicate that the keyChar is unknown or not printable.static final short
VK_0 thru VK_9 are the same as UTF16/ASCII '0' thru '9' [0x30 - 0x39]static final short
SeeVK_0
.static final short
SeeVK_0
.static final short
SeeVK_0
.static final short
SeeVK_0
.static final short
SeeVK_0
.static final short
SeeVK_0
.static final short
SeeVK_0
.static final short
SeeVK_0
.static final short
SeeVK_0
.static final short
VK_A thru VK_Z are the same as Capital UTF16/ASCII 'A' thru 'Z' (0x41 - 0x5A)static final short
Constant for the Accept or Commit function key, Japanese "kakutei".static final short
Numeric keypad add key.static final short
static final short
Constant for the All Candidates function key.static final short
Constant for the Alphanumeric function key.static final short
Constant for the left ALT function key.static final short
Constant for the ALT_GRAPH function key, i.e.static final short
Constant for the "&" key.static final short
Constant for the "*" keystatic final short
Constant for the equals key, "@"static final short
SeeVK_A
.static final short
Constant for the "`" keystatic final short
Constant for the back slash key, "\"static final short
Constant for the BACK SPACE key "\b", matching ASCII.static final short
Constant for the Begin function key.static final short
SeeVK_A
.static final short
Constant for the CANCEL function key.static final short
Constant for the CAPS LOCK function key.static final short
Constant for the "^" key.static final short
Constant for the CLEAR key, i.e.static final short
Constant for the close bracket key, "]"static final short
Constant for the Code Input function key.static final short
Constant for the ":" key.static final short
Constant for the comma key, ","static final short
Constant for the Compose function key.static final short
Constant for the Context Menu key.static final short
Constant for the CTRL function key.static final short
Constant for the Convert function key, Japanese "henkan".static final short
static final short
static final short
SeeVK_A
.static final short
Numeric keypad decimal separator key.static final short
Constant for the DEL key, matching ASCII.static final short
Numeric keypad divide key.static final short
Constant for the "$" key.static final short
Constant for the cursor- or numerical pad down arrow key.static final short
SeeVK_A
.static final short
Constant for the END function key.static final short
Constant for the ENTER key, i.e.static final short
Constant for the equals key, "="static final short
Constant for the ESCAPE function key.static final short
Constant for the Euro currency sign key.static final short
Constant for the "!" key.static final short
SeeVK_A
.static final short
Constant for the Fn function keys.static final short
Constant for the F11 function key.static final short
Constant for the F11 function key.static final short
Constant for the F12 function key.static final short
Constant for the F13 function key.static final short
Constant for the F14 function key.static final short
Constant for the F15 function key.static final short
Constant for the F16 function key.static final short
Constant for the F17 function key.static final short
Constant for the F18 function key.static final short
Constant for the F19 function key.static final short
Constant for the F2 function key.static final short
Constant for the F20 function key.static final short
Constant for the F21 function key.static final short
Constant for the F22 function key.static final short
Constant for the F23 function key.static final short
Constant for the F24 function key.static final short
Constant for the F3 function key.static final short
Constant for the F4 function key.static final short
Constant for the F5 function key.static final short
Constant for the F6 function key.static final short
Constant for the F7 function key.static final short
Constant for the F8 function key.static final short
Constant for the F9 function key.static final short
Constant for the END function key.static final short
static final short
Constant for the Full-Width Characters function key.static final short
SeeVK_A
.static final short
Constant for the equals key, ">"static final short
SeeVK_A
.static final short
Constant for the Half-Width Characters function key.static final short
Constant for the Help function key.static final short
Constant for the Hiragana function key.static final short
Constant for the HOME function key.static final short
SeeVK_A
.static final short
Constant for the input method on/off key.static final short
Constant for the INSERT function key.static final short
Constant for the inverted exclamation mark key.static final short
SeeVK_A
.static final short
Constant for the Japanese-Hiragana function key.static final short
Constant for the Japanese-Katakana function key.static final short
Constant for the Japanese-Roman function key.static final short
SeeVK_A
.static final short
Constant for the locking Kana function key.static final short
Constant for the Katakana function key.static final short
Constant for Keyboard became invisible, e.g.static final short
SeeVK_A
.static final short
Constant for the cursor- or numerical-pad left arrow key.static final short
Constant for the "{" keystatic final short
Constant for the "(" key.static final short
Constant for the equals key, "<"static final short
SeeVK_A
.static final short
Constant for the Meta function key.static final short
Constant for the minus key, "-"static final short
Constant for the Mode Change (?).static final short
Numeric keypad multiply key.static final short
SeeVK_A
.static final short
Constant for the Don't Convert function key, Japanese "muhenkan".static final short
Numeric keypad num lock key.static final short
Constant for the "#" key.static final short
Numeric keypad VK_NUMPAD0 thru VK_NUMPAD9 are mapped to UTF control (0x80 - 0x89).static final short
SeeVK_NUMPAD0
.static final short
SeeVK_NUMPAD0
.static final short
SeeVK_NUMPAD0
.static final short
SeeVK_NUMPAD0
.static final short
SeeVK_NUMPAD0
.static final short
SeeVK_NUMPAD0
.static final short
SeeVK_NUMPAD0
.static final short
SeeVK_NUMPAD0
.static final short
SeeVK_NUMPAD0
.static final short
SeeVK_A
.static final short
Constant for the open bracket key, "["static final short
SeeVK_A
.static final short
Constant for the PAGE DOWN function key.static final short
Constant for the PAGE UP function key.static final short
static final short
Constant for the PAUSE function key.static final short
Constant for the "%" key.static final short
Constant for the period key, "."static final short
Constant for the "|" keystatic final short
Constant for the "+" key.static final short
Constant for the Previous Candidate function key.static final short
Constant for the PRINT function key.static final short
static final short
SeeVK_A
.static final short
Constant for the equals key, "?"static final short
Constant for the "'" key.static final short
Constant for the """ key.static final short
SeeVK_A
.static final short
Constant for the cursor- or numerical-pad right arrow key.static final short
Constant for the "}" keystatic final short
Constant for the ")" key.static final short
Constant for the Roman Characters function key.static final short
SeeVK_A
.static final short
scroll lock key.static final short
Constant for the semicolon key, ";"static final short
Numeric keypad decimal separator key.static final short
Constant for the CTRL function key.static final short
Constant for the forward slash key, "/"static final short
Constant for the SPACE function key.static final short
Constant for the Stop function key.static final short
Numeric keypad subtract key.static final short
SeeVK_A
.static final short
Constant for the HORIZ TAB key "\t", matching ASCII.static final short
Constant for the "~" key, matching ASCIIstatic final short
SeeVK_A
.static final short
This value, 0, is used to indicate that the keyCode is unknown.static final short
Constant for the "_" keystatic final short
static final short
Constant for the cursor- or numerical-pad up arrow key.static final short
SeeVK_A
.static final short
SeeVK_A
.static final short
Constant for the MS "Windows" function key.static final short
SeeVK_A
.static final short
SeeVK_A
.static final short
SeeVK_A
.Fields inherited from class com.jogamp.newt.event.InputEvent
ALT_GRAPH_MASK, ALT_MASK, AUTOREPEAT_MASK, BUTTON1_MASK, BUTTON2_MASK, BUTTON3_MASK, BUTTON4_MASK, BUTTON5_MASK, BUTTON6_MASK, BUTTON7_MASK, BUTTON8_MASK, BUTTON9_MASK, BUTTONALL_MASK, BUTTONLAST_MASK, CONFINED_MASK, CTRL_MASK, INVISIBLE_MASK, META_MASK, SHIFT_MASK
Fields inherited from class com.jogamp.newt.event.NEWTEvent
consumedTag
-
Method Summary
Modifier and TypeMethodDescriptionstatic KeyEvent
create
(short eventType, Object source, long when, int modifiers, short keyCode, short keySym, char keyChar) static String
getEventTypeString
(short type) final char
Returns the UTF-16 character reflecting thekey symbol
incl.final short
Returns the virtual key code using a fixed mapping to the US keyboard layout.final short
Returns the virtual key symbol reflecting the current keyboard layout.static int
getModifierMask
(short vKey) IfvKey
is amodifier key
, method returns the corresponding modifier mask, otherwise 0.final boolean
final boolean
static boolean
isModifierKey
(short vKey) Returnstrue
if the givenvirtualKey
represents a modifier key, otherwisefalse
.final boolean
static boolean
isPrintableKey
(short uniChar, boolean isKeyChar) Returnstrue
if givenuniChar
represents a printable character, i.e.final String
toString()
final StringBuilder
static short
utf16ToVKey
(char keyChar) Methods inherited from class com.jogamp.newt.event.InputEvent
getButtonDownCount, getButtonMask, getButtonsDown, getModifiers, getModifiersString, isAltDown, isAltGraphDown, isAnyButtonDown, isAutoRepeat, isButtonDown, isConfined, isControlDown, isInvisible, isMetaDown, isShiftDown
Methods inherited from class com.jogamp.newt.event.NEWTEvent
getAttachment, getEventType, getWhen, isConsumed, setAttachment, setConsumed, toHexString
Methods inherited from class java.util.EventObject
getSource
-
Field Details
-
EVENT_KEY_PRESSED
public static final short EVENT_KEY_PRESSEDA key has been pressed, excludingauto-repeat
-modifier
keys.- See Also:
-
EVENT_KEY_RELEASED
public static final short EVENT_KEY_RELEASEDA key has been released, excludingauto-repeat
-modifier
keys.- See Also:
-
NULL_CHAR
public static final char NULL_CHARThis value,'\0'
, is used to indicate that the keyChar is unknown or not printable.- See Also:
-
nonPrintableKeys
Non printable key ranges, currently fixed to an array of size 4.Not included, queried upfront:
-
VK_UNDEFINED
public static final short VK_UNDEFINEDThis value, 0, is used to indicate that the keyCode is unknown.- See Also:
-
VK_HOME
public static final short VK_HOMEConstant for the HOME function key. ASCII: Start Of Text.- See Also:
-
VK_END
public static final short VK_ENDConstant for the END function key. ASCII: End Of Text.- See Also:
-
VK_FINAL
public static final short VK_FINALConstant for the END function key. ASCII: End Of Transmission.- See Also:
-
VK_PRINTSCREEN
public static final short VK_PRINTSCREENConstant for the PRINT function key. ASCII: Enquiry.- See Also:
-
VK_BACK_SPACE
public static final short VK_BACK_SPACEConstant for the BACK SPACE key "\b", matching ASCII. Printable!- See Also:
-
VK_TAB
public static final short VK_TABConstant for the HORIZ TAB key "\t", matching ASCII. Printable!- See Also:
-
VK_PAGE_DOWN
public static final short VK_PAGE_DOWNConstant for the PAGE DOWN function key. ASCII: Vertical Tabulation.- See Also:
-
VK_CLEAR
public static final short VK_CLEARConstant for the CLEAR key, i.e. FORM FEED, matching ASCII.- See Also:
-
VK_ENTER
public static final short VK_ENTERConstant for the ENTER key, i.e. CARRIAGE RETURN, matching ASCII. Printable!- See Also:
-
VK_SHIFT
public static final short VK_SHIFTConstant for the CTRL function key. ASCII: shift-in.- See Also:
-
VK_PAGE_UP
public static final short VK_PAGE_UPConstant for the PAGE UP function key. ASCII: Data Link Escape.- See Also:
-
VK_CONTROL
public static final short VK_CONTROLConstant for the CTRL function key. ASCII: device-ctrl-one.- See Also:
-
VK_ALT
public static final short VK_ALTConstant for the left ALT function key. ASCII: device-ctrl-two.- See Also:
-
VK_ALT_GRAPH
public static final short VK_ALT_GRAPHConstant for the ALT_GRAPH function key, i.e. right ALT key. ASCII: device-ctrl-three.- See Also:
-
VK_CAPS_LOCK
public static final short VK_CAPS_LOCKConstant for the CAPS LOCK function key. ASCII: device-ctrl-four.- See Also:
-
VK_PAUSE
public static final short VK_PAUSEConstant for the PAUSE function key. ASCII: sync-idle.- See Also:
-
VK_SCROLL_LOCK
public static final short VK_SCROLL_LOCKscroll lock key. ASCII: End Of Transmission Block.- See Also:
-
VK_CANCEL
public static final short VK_CANCELConstant for the CANCEL function key. ASCII: Cancel.- See Also:
-
VK_INSERT
public static final short VK_INSERTConstant for the INSERT function key. ASCII: Substitute.- See Also:
-
VK_ESCAPE
public static final short VK_ESCAPEConstant for the ESCAPE function key. ASCII: Escape.- See Also:
-
VK_CONVERT
public static final short VK_CONVERTConstant for the Convert function key, Japanese "henkan". ASCII: File Separator.- See Also:
-
VK_NONCONVERT
public static final short VK_NONCONVERTConstant for the Don't Convert function key, Japanese "muhenkan". ASCII: Group Separator.- See Also:
-
VK_ACCEPT
public static final short VK_ACCEPTConstant for the Accept or Commit function key, Japanese "kakutei". ASCII: Record Separator.- See Also:
-
VK_MODECHANGE
public static final short VK_MODECHANGEConstant for the Mode Change (?). ASCII: Unit Separator.- See Also:
-
VK_SPACE
public static final short VK_SPACEConstant for the SPACE function key. ASCII: SPACE.- See Also:
-
VK_EXCLAMATION_MARK
public static final short VK_EXCLAMATION_MARKConstant for the "!" key.- See Also:
-
VK_QUOTEDBL
public static final short VK_QUOTEDBLConstant for the """ key.- See Also:
-
VK_NUMBER_SIGN
public static final short VK_NUMBER_SIGNConstant for the "#" key.- See Also:
-
VK_DOLLAR
public static final short VK_DOLLARConstant for the "$" key.- See Also:
-
VK_PERCENT
public static final short VK_PERCENTConstant for the "%" key.- See Also:
-
VK_AMPERSAND
public static final short VK_AMPERSANDConstant for the "&" key.- See Also:
-
VK_QUOTE
public static final short VK_QUOTEConstant for the "'" key.- See Also:
-
VK_LEFT_PARENTHESIS
public static final short VK_LEFT_PARENTHESISConstant for the "(" key.- See Also:
-
VK_RIGHT_PARENTHESIS
public static final short VK_RIGHT_PARENTHESISConstant for the ")" key.- See Also:
-
VK_ASTERISK
public static final short VK_ASTERISKConstant for the "*" key- See Also:
-
VK_PLUS
public static final short VK_PLUSConstant for the "+" key.- See Also:
-
VK_COMMA
public static final short VK_COMMAConstant for the comma key, ","- See Also:
-
VK_MINUS
public static final short VK_MINUSConstant for the minus key, "-"- See Also:
-
VK_PERIOD
public static final short VK_PERIODConstant for the period key, "."- See Also:
-
VK_SLASH
public static final short VK_SLASHConstant for the forward slash key, "/"- See Also:
-
VK_0
public static final short VK_0VK_0 thru VK_9 are the same as UTF16/ASCII '0' thru '9' [0x30 - 0x39]- See Also:
-
VK_1
public static final short VK_1SeeVK_0
.- See Also:
-
VK_2
public static final short VK_2SeeVK_0
.- See Also:
-
VK_3
public static final short VK_3SeeVK_0
.- See Also:
-
VK_4
public static final short VK_4SeeVK_0
.- See Also:
-
VK_5
public static final short VK_5SeeVK_0
.- See Also:
-
VK_6
public static final short VK_6SeeVK_0
.- See Also:
-
VK_7
public static final short VK_7SeeVK_0
.- See Also:
-
VK_8
public static final short VK_8SeeVK_0
.- See Also:
-
VK_9
public static final short VK_9SeeVK_0
.- See Also:
-
VK_COLON
public static final short VK_COLONConstant for the ":" key.- See Also:
-
VK_SEMICOLON
public static final short VK_SEMICOLONConstant for the semicolon key, ";"- See Also:
-
VK_LESS
public static final short VK_LESSConstant for the equals key, "<"- See Also:
-
VK_EQUALS
public static final short VK_EQUALSConstant for the equals key, "="- See Also:
-
VK_GREATER
public static final short VK_GREATERConstant for the equals key, ">"- See Also:
-
VK_QUESTIONMARK
public static final short VK_QUESTIONMARKConstant for the equals key, "?"- See Also:
-
VK_AT
public static final short VK_ATConstant for the equals key, "@"- See Also:
-
VK_A
public static final short VK_AVK_A thru VK_Z are the same as Capital UTF16/ASCII 'A' thru 'Z' (0x41 - 0x5A)- See Also:
-
VK_B
public static final short VK_BSeeVK_A
.- See Also:
-
VK_C
public static final short VK_CSeeVK_A
.- See Also:
-
VK_D
public static final short VK_DSeeVK_A
.- See Also:
-
VK_E
public static final short VK_ESeeVK_A
.- See Also:
-
VK_F
public static final short VK_FSeeVK_A
.- See Also:
-
VK_G
public static final short VK_GSeeVK_A
.- See Also:
-
VK_H
public static final short VK_HSeeVK_A
.- See Also:
-
VK_I
public static final short VK_ISeeVK_A
.- See Also:
-
VK_J
public static final short VK_JSeeVK_A
.- See Also:
-
VK_K
public static final short VK_KSeeVK_A
.- See Also:
-
VK_L
public static final short VK_LSeeVK_A
.- See Also:
-
VK_M
public static final short VK_MSeeVK_A
.- See Also:
-
VK_N
public static final short VK_NSeeVK_A
.- See Also:
-
VK_O
public static final short VK_OSeeVK_A
.- See Also:
-
VK_P
public static final short VK_PSeeVK_A
.- See Also:
-
VK_Q
public static final short VK_QSeeVK_A
.- See Also:
-
VK_R
public static final short VK_RSeeVK_A
.- See Also:
-
VK_S
public static final short VK_SSeeVK_A
.- See Also:
-
VK_T
public static final short VK_TSeeVK_A
.- See Also:
-
VK_U
public static final short VK_USeeVK_A
.- See Also:
-
VK_V
public static final short VK_VSeeVK_A
.- See Also:
-
VK_W
public static final short VK_WSeeVK_A
.- See Also:
-
VK_X
public static final short VK_XSeeVK_A
.- See Also:
-
VK_Y
public static final short VK_YSeeVK_A
.- See Also:
-
VK_Z
public static final short VK_ZSeeVK_A
.- See Also:
-
VK_OPEN_BRACKET
public static final short VK_OPEN_BRACKETConstant for the open bracket key, "["- See Also:
-
VK_BACK_SLASH
public static final short VK_BACK_SLASHConstant for the back slash key, "\"- See Also:
-
VK_CLOSE_BRACKET
public static final short VK_CLOSE_BRACKETConstant for the close bracket key, "]"- See Also:
-
VK_CIRCUMFLEX
public static final short VK_CIRCUMFLEXConstant for the "^" key.- See Also:
-
VK_UNDERSCORE
public static final short VK_UNDERSCOREConstant for the "_" key- See Also:
-
VK_BACK_QUOTE
public static final short VK_BACK_QUOTEConstant for the "`" key- See Also:
-
VK_F1
public static final short VK_F1Constant for the Fn function keys.F1..F24, i.e. Fn, are mapped from on
0x60+n
->[0x61 .. 0x78]
.Warning: The Fn function keys do collide with unicode characters small 'a' thru 'x'!
See Unicode Collision for details.- See Also:
-
VK_F2
public static final short VK_F2Constant for the F2 function key. SeeVK_F1
.- See Also:
-
VK_F3
public static final short VK_F3Constant for the F3 function key. SeeVK_F1
.- See Also:
-
VK_F4
public static final short VK_F4Constant for the F4 function key. SeeVK_F1
.- See Also:
-
VK_F5
public static final short VK_F5Constant for the F5 function key. SeeVK_F1
.- See Also:
-
VK_F6
public static final short VK_F6Constant for the F6 function key. SeeVK_F1
.- See Also:
-
VK_F7
public static final short VK_F7Constant for the F7 function key. SeeVK_F1
.- See Also:
-
VK_F8
public static final short VK_F8Constant for the F8 function key. SeeVK_F1
.- See Also:
-
VK_F9
public static final short VK_F9Constant for the F9 function key. SeeVK_F1
.- See Also:
-
VK_F10
public static final short VK_F10Constant for the F11 function key. SeeVK_F1
.- See Also:
-
VK_F11
public static final short VK_F11Constant for the F11 function key. SeeVK_F1
.- See Also:
-
VK_F12
public static final short VK_F12Constant for the F12 function key. SeeVK_F1
.- See Also:
-
VK_F13
public static final short VK_F13Constant for the F13 function key. SeeVK_F1
.- See Also:
-
VK_F14
public static final short VK_F14Constant for the F14 function key. SeeVK_F1
.- See Also:
-
VK_F15
public static final short VK_F15Constant for the F15 function key. SeeVK_F1
.- See Also:
-
VK_F16
public static final short VK_F16Constant for the F16 function key. SeeVK_F1
.- See Also:
-
VK_F17
public static final short VK_F17Constant for the F17 function key. SeeVK_F1
.- See Also:
-
VK_F18
public static final short VK_F18Constant for the F18 function key. SeeVK_F1
.- See Also:
-
VK_F19
public static final short VK_F19Constant for the F19 function key. SeeVK_F1
.- See Also:
-
VK_F20
public static final short VK_F20Constant for the F20 function key. SeeVK_F1
.- See Also:
-
VK_F21
public static final short VK_F21Constant for the F21 function key. SeeVK_F1
.- See Also:
-
VK_F22
public static final short VK_F22Constant for the F22 function key. SeeVK_F1
.- See Also:
-
VK_F23
public static final short VK_F23Constant for the F23 function key. SeeVK_F1
.- See Also:
-
VK_F24
public static final short VK_F24Constant for the F24 function key. SeeVK_F1
.- See Also:
-
VK_LEFT_BRACE
public static final short VK_LEFT_BRACEConstant for the "{" key- See Also:
-
VK_PIPE
public static final short VK_PIPEConstant for the "|" key- See Also:
-
VK_RIGHT_BRACE
public static final short VK_RIGHT_BRACEConstant for the "}" key- See Also:
-
VK_TILDE
public static final short VK_TILDEConstant for the "~" key, matching ASCII- See Also:
-
VK_SEPARATOR
public static final short VK_SEPARATORNumeric keypad decimal separator key. Non printable UTF control.- See Also:
-
VK_NUMPAD0
public static final short VK_NUMPAD0Numeric keypad VK_NUMPAD0 thru VK_NUMPAD9 are mapped to UTF control (0x80 - 0x89). Non printable UTF control.- See Also:
-
VK_NUMPAD1
public static final short VK_NUMPAD1SeeVK_NUMPAD0
.- See Also:
-
VK_NUMPAD2
public static final short VK_NUMPAD2SeeVK_NUMPAD0
.- See Also:
-
VK_NUMPAD3
public static final short VK_NUMPAD3SeeVK_NUMPAD0
.- See Also:
-
VK_NUMPAD4
public static final short VK_NUMPAD4SeeVK_NUMPAD0
.- See Also:
-
VK_NUMPAD5
public static final short VK_NUMPAD5SeeVK_NUMPAD0
.- See Also:
-
VK_NUMPAD6
public static final short VK_NUMPAD6SeeVK_NUMPAD0
.- See Also:
-
VK_NUMPAD7
public static final short VK_NUMPAD7SeeVK_NUMPAD0
.- See Also:
-
VK_NUMPAD8
public static final short VK_NUMPAD8SeeVK_NUMPAD0
.- See Also:
-
VK_NUMPAD9
public static final short VK_NUMPAD9SeeVK_NUMPAD0
.- See Also:
-
VK_DECIMAL
public static final short VK_DECIMALNumeric keypad decimal separator key. Non printable UTF control.- See Also:
-
VK_ADD
public static final short VK_ADDNumeric keypad add key. Non printable UTF control.- See Also:
-
VK_SUBTRACT
public static final short VK_SUBTRACTNumeric keypad subtract key. Non printable UTF control.- See Also:
-
VK_MULTIPLY
public static final short VK_MULTIPLYNumeric keypad multiply key. Non printable UTF control.- See Also:
-
VK_DIVIDE
public static final short VK_DIVIDENumeric keypad divide key. Non printable UTF control.- See Also:
-
VK_DELETE
public static final short VK_DELETEConstant for the DEL key, matching ASCII. Non printable UTF control.- See Also:
-
VK_NUM_LOCK
public static final short VK_NUM_LOCKNumeric keypad num lock key. Non printable UTF control.- See Also:
-
VK_LEFT
public static final short VK_LEFTConstant for the cursor- or numerical-pad left arrow key. Non printable UTF control.- See Also:
-
VK_UP
public static final short VK_UPConstant for the cursor- or numerical-pad up arrow key. Non printable UTF control.- See Also:
-
VK_RIGHT
public static final short VK_RIGHTConstant for the cursor- or numerical-pad right arrow key. Non printable UTF control.- See Also:
-
VK_DOWN
public static final short VK_DOWNConstant for the cursor- or numerical pad down arrow key. Non printable UTF control.- See Also:
-
VK_CONTEXT_MENU
public static final short VK_CONTEXT_MENUConstant for the Context Menu key. Non printable UTF control.- See Also:
-
VK_WINDOWS
public static final short VK_WINDOWSConstant for the MS "Windows" function key. It is used for both the left and right version of the key.- See Also:
-
VK_META
public static final short VK_METAConstant for the Meta function key.- See Also:
-
VK_HELP
public static final short VK_HELPConstant for the Help function key.- See Also:
-
VK_COMPOSE
public static final short VK_COMPOSEConstant for the Compose function key.- See Also:
-
VK_BEGIN
public static final short VK_BEGINConstant for the Begin function key.- See Also:
-
VK_STOP
public static final short VK_STOPConstant for the Stop function key.- See Also:
-
VK_INVERTED_EXCLAMATION_MARK
public static final short VK_INVERTED_EXCLAMATION_MARKConstant for the inverted exclamation mark key.- See Also:
-
VK_EURO_SIGN
public static final short VK_EURO_SIGNConstant for the Euro currency sign key.- See Also:
-
VK_CUT
public static final short VK_CUT- See Also:
-
VK_COPY
public static final short VK_COPY- See Also:
-
VK_PASTE
public static final short VK_PASTE- See Also:
-
VK_UNDO
public static final short VK_UNDO- See Also:
-
VK_AGAIN
public static final short VK_AGAIN- See Also:
-
VK_FIND
public static final short VK_FIND- See Also:
-
VK_PROPS
public static final short VK_PROPS- See Also:
-
VK_INPUT_METHOD_ON_OFF
public static final short VK_INPUT_METHOD_ON_OFFConstant for the input method on/off key.- See Also:
-
VK_CODE_INPUT
public static final short VK_CODE_INPUTConstant for the Code Input function key.- See Also:
-
VK_ROMAN_CHARACTERS
public static final short VK_ROMAN_CHARACTERSConstant for the Roman Characters function key.- See Also:
-
VK_ALL_CANDIDATES
public static final short VK_ALL_CANDIDATESConstant for the All Candidates function key.- See Also:
-
VK_PREVIOUS_CANDIDATE
public static final short VK_PREVIOUS_CANDIDATEConstant for the Previous Candidate function key.- See Also:
-
VK_ALPHANUMERIC
public static final short VK_ALPHANUMERICConstant for the Alphanumeric function key.- See Also:
-
VK_KATAKANA
public static final short VK_KATAKANAConstant for the Katakana function key.- See Also:
-
VK_HIRAGANA
public static final short VK_HIRAGANAConstant for the Hiragana function key.- See Also:
-
VK_FULL_WIDTH
public static final short VK_FULL_WIDTHConstant for the Full-Width Characters function key.- See Also:
-
VK_HALF_WIDTH
public static final short VK_HALF_WIDTHConstant for the Half-Width Characters function key.- See Also:
-
VK_JAPANESE_KATAKANA
public static final short VK_JAPANESE_KATAKANAConstant for the Japanese-Katakana function key. This key switches to a Japanese input method and selects its Katakana input mode.- See Also:
-
VK_JAPANESE_HIRAGANA
public static final short VK_JAPANESE_HIRAGANAConstant for the Japanese-Hiragana function key. This key switches to a Japanese input method and selects its Hiragana input mode.- See Also:
-
VK_JAPANESE_ROMAN
public static final short VK_JAPANESE_ROMANConstant for the Japanese-Roman function key. This key switches to a Japanese input method and selects its Roman-Direct input mode.- See Also:
-
VK_KANA_LOCK
public static final short VK_KANA_LOCKConstant for the locking Kana function key. This key locks the keyboard into a Kana layout.- See Also:
-
VK_KEYBOARD_INVISIBLE
public static final short VK_KEYBOARD_INVISIBLEConstant for Keyboard became invisible, e.g. Android's soft keyboard Back button hit while keyboard is visible.- See Also:
-
-
Method Details
-
create
-
getKeyChar
public final char getKeyChar()Returns the UTF-16 character reflecting thekey symbol
incl. activemodifiers
.- See Also:
-
getKeySymbol
public final short getKeySymbol()Returns the virtual key symbol reflecting the current keyboard layout.For
printable keys
, the key symbol is theunmodified
representation of the UTF-16key char
.
E.g. symbol [VK_A
, 'A'] for char 'a'.- See Also:
-
getKeyCode
public final short getKeyCode()Returns the virtual key code using a fixed mapping to the US keyboard layout.In contrast to
key symbol
, key code uses a fixed US keyboard layout and therefore is keyboard layout independent.E.g. virtual key code
VK_Y
denotes the same physical key regardless whether keyboard layoutQWERTY
orQWERTZ
is active. Thekey symbol
of the former isVK_Y
, where the latter producesVK_Y
.- See Also:
-
toString
- Overrides:
toString
in classInputEvent
-
toString
- Overrides:
toString
in classInputEvent
-
getEventTypeString
-
utf16ToVKey
public static short utf16ToVKey(char keyChar) -
isModifierKey
public static boolean isModifierKey(short vKey) Returnstrue
if the givenvirtualKey
represents a modifier key, otherwisefalse
.A modifier key is one of
VK_SHIFT
,VK_CONTROL
,VK_ALT
,VK_ALT_GRAPH
,VK_META
. -
getModifierMask
public static int getModifierMask(short vKey) IfvKey
is amodifier key
, method returns the corresponding modifier mask, otherwise 0. -
isModifierKey
public final boolean isModifierKey()Returnstrue
ifkey symbol
represents a modifier key, otherwisefalse
.See
isModifierKey(short)
for details.Note: Implementation uses a cached value.
-
isActionKey
public final boolean isActionKey()Returnstrue
ifkey symbol
represents a non-printable and non-modifier
action key, otherwisefalse
.Hence it is the set A of all keys U w/o printable P and w/o modifiers M:
A = U - ( P + M )
- See Also:
-
isPrintableKey
public static boolean isPrintableKey(short uniChar, boolean isKeyChar) Returnstrue
if givenuniChar
represents a printable character, i.e. a value other thanVK_UNDEFINED
and not a control or non-printable private code.A printable character is neither a
modifier key
, nor anaction key
.Otherwise returns
false
.Distinction of key character and virtual key code is made due to unicode collision.
- Parameters:
uniChar
- the UTF-16 unicode value, which maybe a virtual key code or key character.isKeyChar
- true ifuniChar
is a key character, otherwise a virtual key code
-
isPrintableKey
public final boolean isPrintableKey()Returnstrue
ifkey symbol
andkey char
represents a printable character, i.e. a value other thanVK_UNDEFINED
and not a control or non-printable private code.A printable character is neither a
modifier key
, nor anaction key
.Otherwise returns
false
.
-