| # | 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.
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.
The following Key-codes and key-symbols 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
| Modifier and Type | Class and Description |
|---|---|
| public static class |
| Modifier and Type | Field and Description |
|---|---|
| public static final short | EVENT_KEY_PRESSED
A key has been pressed, excluding |
| public static final short | EVENT_KEY_RELEASED
A key has been released, excluding |
| private static final byte | |
| private static final byte | |
| private static final byte | |
| private final byte | |
| private final char | |
| private final short | |
| private final short | |
| public static final KeyEvent. | nonPrintableKeys
Non printable key ranges, currently fixed to an array of size 4. |
| public static final char | NULL_CHAR
This value, |
| public static final short | VK_0
VK_0 thru VK_9 are the same as UTF16/ASCII '0' thru '9' [0x30 - 0x39] |
| public static final short | |
| public static final short | |
| public static final short | |
| public static final short | |
| public static final short | |
| public static final short | |
| public static final short | |
| public static final short | |
| public static final short | |
| public static final short | VK_A
VK_A thru VK_Z are the same as Capital UTF16/ASCII 'A' thru 'Z' (0x41 - 0x5A) |
| public static final short | VK_ACCEPT
Constant for the Accept or Commit function key, Japanese "kakutei". |
| public static final short | VK_ADD
Numeric keypad add key. |
| public static final short | |
| public static final short | VK_ALL_CANDIDATES
Constant for the All Candidates function key. |
| public static final short | VK_ALPHANUMERIC
Constant for the Alphanumeric function key. |
| public static final short | VK_ALT
Constant for the left ALT function key. |
| public static final short | VK_ALT_GRAPH
Constant for the ALT_GRAPH function key, i.e. right ALT key. |
| public static final short | VK_AMPERSAND
Constant for the "&" key. |
| public static final short | VK_ASTERISK
Constant for the "*" key |
| public static final short | VK_AT
Constant for the equals key, "@" |
| public static final short | |
| public static final short | VK_BACK_QUOTE
Constant for the "`" key |
| public static final short | VK_BACK_SLASH
Constant for the back slash key, "\" |
| public static final short | VK_BACK_SPACE
Constant for the BACK SPACE key "\b", matching ASCII. |
| public static final short | VK_BEGIN
Constant for the Begin function key. |
| public static final short | |
| public static final short | VK_CANCEL
Constant for the CANCEL function key. |
| public static final short | VK_CAPS_LOCK
Constant for the CAPS LOCK function key. |
| public static final short | VK_CIRCUMFLEX
Constant for the "^" key. |
| public static final short | VK_CLEAR
Constant for the CLEAR key, i.e. FORM FEED, matching ASCII. |
| public static final short | VK_CLOSE_BRACKET
Constant for the close bracket key, "]" |
| public static final short | VK_CODE_INPUT
Constant for the Code Input function key. |
| public static final short | VK_COLON
Constant for the ":" key. |
| public static final short | VK_COMMA
Constant for the comma key, "," |
| public static final short | VK_COMPOSE
Constant for the Compose function key. |
| public static final short | VK_CONTEXT_MENU
Constant for the Context Menu key. |
| public static final short | VK_CONTROL
Constant for the CTRL function key. |
| public static final short | VK_CONVERT
Constant for the Convert function key, Japanese "henkan". |
| public static final short | |
| public static final short | |
| public static final short | |
| public static final short | VK_DECIMAL
Numeric keypad decimal separator key. |
| public static final short | VK_DELETE
Constant for the DEL key, matching ASCII. |
| public static final short | VK_DIVIDE
Numeric keypad divide key. |
| public static final short | VK_DOLLAR
Constant for the "$" key. |
| public static final short | VK_DOWN
Constant for the cursor- or numerical pad down arrow key. |
| public static final short | |
| public static final short | VK_END
Constant for the END function key. |
| public static final short | VK_ENTER
Constant for the ENTER key, i.e. CARRIAGE RETURN, matching ASCII. |
| public static final short | VK_EQUALS
Constant for the equals key, "=" |
| public static final short | VK_ESCAPE
Constant for the ESCAPE function key. |
| public static final short | VK_EURO_SIGN
Constant for the Euro currency sign key. |
| public static final short | VK_EXCLAMATION_MARK
Constant for the "!" key. |
| public static final short | |
| public static final short | VK_F1
Constant for the Fn function keys. |
| public static final short | VK_F10
Constant for the F11 function key. |
| public static final short | VK_F11
Constant for the F11 function key. |
| public static final short | VK_F12
Constant for the F12 function key. |
| public static final short | VK_F13
Constant for the F13 function key. |
| public static final short | VK_F14
Constant for the F14 function key. |
| public static final short | VK_F15
Constant for the F15 function key. |
| public static final short | VK_F16
Constant for the F16 function key. |
| public static final short | VK_F17
Constant for the F17 function key. |
| public static final short | VK_F18
Constant for the F18 function key. |
| public static final short | VK_F19
Constant for the F19 function key. |
| public static final short | VK_F2
Constant for the F2 function key. |
| public static final short | VK_F20
Constant for the F20 function key. |
| public static final short | VK_F21
Constant for the F21 function key. |
| public static final short | VK_F22
Constant for the F22 function key. |
| public static final short | VK_F23
Constant for the F23 function key. |
| public static final short | VK_F24
Constant for the F24 function key. |
| public static final short | VK_F3
Constant for the F3 function key. |
| public static final short | VK_F4
Constant for the F4 function key. |
| public static final short | VK_F5
Constant for the F5 function key. |
| public static final short | VK_F6
Constant for the F6 function key. |
| public static final short | VK_F7
Constant for the F7 function key. |
| public static final short | VK_F8
Constant for the F8 function key. |
| public static final short | VK_F9
Constant for the F9 function key. |
| public static final short | VK_FINAL
Constant for the END function key. |
| public static final short | |
| pack-priv static final short | |
| pack-priv static final short | |
| pack-priv static final short | |
| pack-priv static final short | VK_FREE0A
LINE_FEED "\n", matching ASCII, n/a on keyboard. |
| pack-priv static final short | |
| pack-priv static final short | |
| pack-priv static final short | |
| public static final short | VK_FULL_WIDTH
Constant for the Full-Width Characters function key. |
| public static final short | |
| public static final short | VK_GREATER
Constant for the equals key, ">" |
| public static final short | |
| public static final short | VK_HALF_WIDTH
Constant for the Half-Width Characters function key. |
| public static final short | VK_HELP
Constant for the Help function key. |
| public static final short | VK_HIRAGANA
Constant for the Hiragana function key. |
| public static final short | VK_HOME
Constant for the HOME function key. |
| public static final short | |
| public static final short | VK_INPUT_METHOD_ON_OFF
Constant for the input method on/off key. |
| public static final short | VK_INSERT
Constant for the INSERT function key. |
| public static final short | VK_INVERTED_EXCLAMATION_MARK
Constant for the inverted exclamation mark key. |
| public static final short | |
| public static final short | VK_JAPANESE_HIRAGANA
Constant for the Japanese-Hiragana function key. |
| public static final short | VK_JAPANESE_KATAKANA
Constant for the Japanese-Katakana function key. |
| public static final short | VK_JAPANESE_ROMAN
Constant for the Japanese-Roman function key. |
| public static final short | |
| public static final short | VK_KANA_LOCK
Constant for the locking Kana function key. |
| public static final short | VK_KATAKANA
Constant for the Katakana function key. |
| public static final short | VK_KEYBOARD_INVISIBLE
Constant for Keyboard became invisible, e.g. Android's soft keyboard Back button hit while keyboard is visible. |
| public static final short | |
| public static final short | VK_LEFT
Constant for the cursor- or numerical-pad left arrow key. |
| public static final short | VK_LEFT_BRACE
Constant for the "{" key |
| public static final short | VK_LEFT_PARENTHESIS
Constant for the "(" key. |
| public static final short | VK_LESS
Constant for the equals key, "<" |
| public static final short | |
| public static final short | VK_META
Constant for the Meta function key. |
| public static final short | VK_MINUS
Constant for the minus key, "-" |
| public static final short | VK_MODECHANGE
Constant for the Mode Change (?). |
| public static final short | VK_MULTIPLY
Numeric keypad multiply key. |
| public static final short | |
| public static final short | VK_NONCONVERT
Constant for the Don't Convert function key, Japanese "muhenkan". |
| public static final short | VK_NUM_LOCK
Numeric keypad num lock key. |
| public static final short | VK_NUMBER_SIGN
Constant for the "#" key. |
| public static final short | VK_NUMPAD0
Numeric keypad VK_NUMPAD0 thru VK_NUMPAD9 are mapped to UTF control (0x80 - 0x89). |
| public static final short | VK_NUMPAD1
See |
| public static final short | VK_NUMPAD2
See |
| public static final short | VK_NUMPAD3
See |
| public static final short | VK_NUMPAD4
See |
| public static final short | VK_NUMPAD5
See |
| public static final short | VK_NUMPAD6
See |
| public static final short | VK_NUMPAD7
See |
| public static final short | VK_NUMPAD8
See |
| public static final short | VK_NUMPAD9
See |
| public static final short | |
| public static final short | VK_OPEN_BRACKET
Constant for the open bracket key, "[" |
| public static final short | |
| public static final short | VK_PAGE_DOWN
Constant for the PAGE DOWN function key. |
| public static final short | VK_PAGE_UP
Constant for the PAGE UP function key. |
| public static final short | |
| public static final short | VK_PAUSE
Constant for the PAUSE function key. |
| public static final short | VK_PERCENT
Constant for the "%" key. |
| public static final short | VK_PERIOD
Constant for the period key, "." |
| public static final short | VK_PIPE
Constant for the "|" key |
| public static final short | VK_PLUS
Constant for the "+" key. |
| public static final short | VK_PREVIOUS_CANDIDATE
Constant for the Previous Candidate function key. |
| public static final short | VK_PRINTSCREEN
Constant for the PRINT function key. |
| public static final short | |
| public static final short | |
| public static final short | VK_QUESTIONMARK
Constant for the equals key, "?" |
| public static final short | VK_QUOTE
Constant for the "'" key. |
| public static final short | VK_QUOTEDBL
Constant for the """ key. |
| public static final short | |
| public static final short | VK_RIGHT
Constant for the cursor- or numerical-pad right arrow key. |
| public static final short | VK_RIGHT_BRACE
Constant for the "}" key |
| public static final short | VK_RIGHT_PARENTHESIS
Constant for the ")" key. |
| public static final short | VK_ROMAN_CHARACTERS
Constant for the Roman Characters function key. |
| public static final short | |
| public static final short | VK_SCROLL_LOCK
scroll lock key. |
| public static final short | VK_SEMICOLON
Constant for the semicolon key, ";" |
| public static final short | VK_SEPARATOR
Numeric keypad decimal separator key. |
| public static final short | VK_SHIFT
Constant for the CTRL function key. |
| public static final short | VK_SLASH
Constant for the forward slash key, "/" |
| public static final short | VK_SPACE
Constant for the SPACE function key. |
| public static final short | VK_STOP
Constant for the Stop function key. |
| public static final short | VK_SUBTRACT
Numeric keypad subtract key. |
| public static final short | |
| public static final short | VK_TAB
Constant for the HORIZ TAB key "\t", matching ASCII. |
| public static final short | VK_TILDE
Constant for the "~" key, matching ASCII |
| public static final short | |
| public static final short | VK_UNDEFINED
This value, , is used to indicate that the keyCode is unknown. |
| public static final short | VK_UNDERSCORE
Constant for the "_" key |
| public static final short | |
| public static final short | VK_UP
Constant for the cursor- or numerical-pad up arrow key. |
| public static final short | |
| public static final short | |
| public static final short | VK_WINDOWS
Constant for the MS "Windows" function key. |
| public static final short | |
| public static final short | |
| public static final short |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static KeyEvent | |
| public static String | |
| public final char | |
| public final short | |
| public final short | |
| public static int | getModifierMask(final short vKey)
If |
| public final boolean | isActionKey()
Returns |
| public static boolean | isModifierKey(final short vKey)
Returns |
| public final boolean | |
| public static boolean | isPrintableKey(final short
the UTF-16 unicode value, which maybe a virtual key code or key character. uniChar, final boolean true if isKeyChar)uniChar is a key character, otherwise a virtual key codeReturns |
| public final boolean | isPrintableKey()
Returns |
| public final String | toString()
Overrides com. |
| public final StringBuilder | |
| public static short | Returns: KeyEvent virtual key (VK) value.UTF16 value to map. It is expected that the incoming keyChar value is unshifted and unmodified,
however, lower case a-z is mapped to keyChar)KeyEvent#VK_A - KeyEvent#VK_Z.
|