com.jogamp.newt.event

## Class KeyEvent

- java.lang.Object
- - java.util.EventObject
  - - com.jogamp.newt.event.NEWTEvent
    - - com.jogamp.newt.event.InputEvent
      - - com.jogamp.newt.event.KeyEvent

- All Implemented Interfaces:
    Serializable

      public class KeyEvent
      extends InputEvent

  ##### 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 |

  In case the native platform does not deliver keyboard events in the above order or skip events, the NEWT driver will reorder and inject synthetic events if required.

  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:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `KeyEvent.NonPrintableRange`

    - ### Nested classes/interfaces inherited from class com.jogamp.newt.event.InputEvent

      `InputEvent.InputClass, InputEvent.InputType`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static short` | `EVENT_KEY_PRESSED` A key has been pressed, excluding `auto-repeat`-`modifier` keys.
    `static short` | `EVENT_KEY_RELEASED` A key has been released, excluding `auto-repeat`-`modifier` keys.
    `static KeyEvent.NonPrintableRange[]` | `nonPrintableKeys` Non printable key ranges, currently fixed to an array of size 4.
    `static char` | `NULL_CHAR` This value, `'\0'`, is used to indicate that the keyChar is unknown or not printable.
    `static short` | `VK_0` VK_0 thru VK_9 are the same as UTF16/ASCII '0' thru '9' [0x30 - 0x39]
    `static short` | `VK_1` See `VK_0`.
    `static short` | `VK_2` See `VK_0`.
    `static short` | `VK_3` See `VK_0`.
    `static short` | `VK_4` See `VK_0`.
    `static short` | `VK_5` See `VK_0`.
    `static short` | `VK_6` See `VK_0`.
    `static short` | `VK_7` See `VK_0`.
    `static short` | `VK_8` See `VK_0`.
    `static short` | `VK_9` See `VK_0`.
    `static short` | `VK_A` VK_A thru VK_Z are the same as Capital UTF16/ASCII 'A' thru 'Z' (0x41 - 0x5A)
    `static short` | `VK_ACCEPT` Constant for the Accept or Commit function key, Japanese "kakutei".
    `static short` | `VK_ADD` Numeric keypad add key.
    `static short` | `VK_AGAIN`
    `static short` | `VK_ALL_CANDIDATES` Constant for the All Candidates function key.
    `static short` | `VK_ALPHANUMERIC` Constant for the Alphanumeric function key.
    `static short` | `VK_ALT` Constant for the left ALT function key.
    `static short` | `VK_ALT_GRAPH` Constant for the ALT_GRAPH function key, i.e.
    `static short` | `VK_AMPERSAND` Constant for the "&" key.
    `static short` | `VK_ASTERISK` Constant for the "*" key
    `static short` | `VK_AT` Constant for the equals key, "@"
    `static short` | `VK_B` See `VK_A`.
    `static short` | `VK_BACK_QUOTE` Constant for the "`" key
    `static short` | `VK_BACK_SLASH` Constant for the back slash key, "\"
    `static short` | `VK_BACK_SPACE` Constant for the BACK SPACE key "\b", matching ASCII.
    `static short` | `VK_BEGIN` Constant for the Begin function key.
    `static short` | `VK_C` See `VK_A`.
    `static short` | `VK_CANCEL` Constant for the CANCEL function key.
    `static short` | `VK_CAPS_LOCK` Constant for the CAPS LOCK function key.
    `static short` | `VK_CIRCUMFLEX` Constant for the "^" key.
    `static short` | `VK_CLEAR` Constant for the CLEAR key, i.e.
    `static short` | `VK_CLOSE_BRACKET` Constant for the close bracket key, "]"
    `static short` | `VK_CODE_INPUT` Constant for the Code Input function key.
    `static short` | `VK_COLON` Constant for the ":" key.
    `static short` | `VK_COMMA` Constant for the comma key, ","
    `static short` | `VK_COMPOSE` Constant for the Compose function key.
    `static short` | `VK_CONTEXT_MENU` Constant for the Context Menu key.
    `static short` | `VK_CONTROL` Constant for the CTRL function key.
    `static short` | `VK_CONVERT` Constant for the Convert function key, Japanese "henkan".
    `static short` | `VK_COPY`
    `static short` | `VK_CUT`
    `static short` | `VK_D` See `VK_A`.
    `static short` | `VK_DECIMAL` Numeric keypad decimal separator key.
    `static short` | `VK_DELETE` Constant for the DEL key, matching ASCII.
    `static short` | `VK_DIVIDE` Numeric keypad divide key.
    `static short` | `VK_DOLLAR` Constant for the "$" key.
    `static short` | `VK_DOWN` Constant for the cursor- or numerical pad down arrow key.
    `static short` | `VK_E` See `VK_A`.
    `static short` | `VK_END` Constant for the END function key.
    `static short` | `VK_ENTER` Constant for the ENTER key, i.e.
    `static short` | `VK_EQUALS` Constant for the equals key, "="
    `static short` | `VK_ESCAPE` Constant for the ESCAPE function key.
    `static short` | `VK_EURO_SIGN` Constant for the Euro currency sign key.
    `static short` | `VK_EXCLAMATION_MARK` Constant for the "!" key.
    `static short` | `VK_F` See `VK_A`.
    `static short` | `VK_F1` Constant for the Fn function keys.
    `static short` | `VK_F10` Constant for the F11 function key.
    `static short` | `VK_F11` Constant for the F11 function key.
    `static short` | `VK_F12` Constant for the F12 function key.
    `static short` | `VK_F13` Constant for the F13 function key.
    `static short` | `VK_F14` Constant for the F14 function key.
    `static short` | `VK_F15` Constant for the F15 function key.
    `static short` | `VK_F16` Constant for the F16 function key.
    `static short` | `VK_F17` Constant for the F17 function key.
    `static short` | `VK_F18` Constant for the F18 function key.
    `static short` | `VK_F19` Constant for the F19 function key.
    `static short` | `VK_F2` Constant for the F2 function key.
    `static short` | `VK_F20` Constant for the F20 function key.
    `static short` | `VK_F21` Constant for the F21 function key.
    `static short` | `VK_F22` Constant for the F22 function key.
    `static short` | `VK_F23` Constant for the F23 function key.
    `static short` | `VK_F24` Constant for the F24 function key.
    `static short` | `VK_F3` Constant for the F3 function key.
    `static short` | `VK_F4` Constant for the F4 function key.
    `static short` | `VK_F5` Constant for the F5 function key.
    `static short` | `VK_F6` Constant for the F6 function key.
    `static short` | `VK_F7` Constant for the F7 function key.
    `static short` | `VK_F8` Constant for the F8 function key.
    `static short` | `VK_F9` Constant for the F9 function key.
    `static short` | `VK_FINAL` Constant for the END function key.
    `static short` | `VK_FIND`
    `static short` | `VK_FULL_WIDTH` Constant for the Full-Width Characters function key.
    `static short` | `VK_G` See `VK_A`.
    `static short` | `VK_GREATER` Constant for the equals key, ">"
    `static short` | `VK_H` See `VK_A`.
    `static short` | `VK_HALF_WIDTH` Constant for the Half-Width Characters function key.
    `static short` | `VK_HELP` Constant for the Help function key.
    `static short` | `VK_HIRAGANA` Constant for the Hiragana function key.
    `static short` | `VK_HOME` Constant for the HOME function key.
    `static short` | `VK_I` See `VK_A`.
    `static short` | `VK_INPUT_METHOD_ON_OFF` Constant for the input method on/off key.
    `static short` | `VK_INSERT` Constant for the INSERT function key.
    `static short` | `VK_INVERTED_EXCLAMATION_MARK` Constant for the inverted exclamation mark key.
    `static short` | `VK_J` See `VK_A`.
    `static short` | `VK_JAPANESE_HIRAGANA` Constant for the Japanese-Hiragana function key.
    `static short` | `VK_JAPANESE_KATAKANA` Constant for the Japanese-Katakana function key.
    `static short` | `VK_JAPANESE_ROMAN` Constant for the Japanese-Roman function key.
    `static short` | `VK_K` See `VK_A`.
    `static short` | `VK_KANA_LOCK` Constant for the locking Kana function key.
    `static short` | `VK_KATAKANA` Constant for the Katakana function key.
    `static short` | `VK_KEYBOARD_INVISIBLE` Constant for Keyboard became invisible, e.g.
    `static short` | `VK_L` See `VK_A`.
    `static short` | `VK_LEFT` Constant for the cursor- or numerical-pad left arrow key.
    `static short` | `VK_LEFT_BRACE` Constant for the "{" key
    `static short` | `VK_LEFT_PARENTHESIS` Constant for the "(" key.
    `static short` | `VK_LESS` Constant for the equals key, "<"
    `static short` | `VK_M` See `VK_A`.
    `static short` | `VK_META` Constant for the Meta function key.
    `static short` | `VK_MINUS` Constant for the minus key, "-"
    `static short` | `VK_MODECHANGE` Constant for the Mode Change (?).
    `static short` | `VK_MULTIPLY` Numeric keypad multiply key.
    `static short` | `VK_N` See `VK_A`.
    `static short` | `VK_NONCONVERT` Constant for the Don't Convert function key, Japanese "muhenkan".
    `static short` | `VK_NUM_LOCK` Numeric keypad num lock key.
    `static short` | `VK_NUMBER_SIGN` Constant for the "#" key.
    `static short` | `VK_NUMPAD0` Numeric keypad VK_NUMPAD0 thru VK_NUMPAD9 are mapped to UTF control (0x80 - 0x89).
    `static short` | `VK_NUMPAD1` See `VK_NUMPAD0`.
    `static short` | `VK_NUMPAD2` See `VK_NUMPAD0`.
    `static short` | `VK_NUMPAD3` See `VK_NUMPAD0`.
    `static short` | `VK_NUMPAD4` See `VK_NUMPAD0`.
    `static short` | `VK_NUMPAD5` See `VK_NUMPAD0`.
    `static short` | `VK_NUMPAD6` See `VK_NUMPAD0`.
    `static short` | `VK_NUMPAD7` See `VK_NUMPAD0`.
    `static short` | `VK_NUMPAD8` See `VK_NUMPAD0`.
    `static short` | `VK_NUMPAD9` See `VK_NUMPAD0`.
    `static short` | `VK_O` See `VK_A`.
    `static short` | `VK_OPEN_BRACKET` Constant for the open bracket key, "["
    `static short` | `VK_P` See `VK_A`.
    `static short` | `VK_PAGE_DOWN` Constant for the PAGE DOWN function key.
    `static short` | `VK_PAGE_UP` Constant for the PAGE UP function key.
    `static short` | `VK_PASTE`
    `static short` | `VK_PAUSE` Constant for the PAUSE function key.
    `static short` | `VK_PERCENT` Constant for the "%" key.
    `static short` | `VK_PERIOD` Constant for the period key, "."
    `static short` | `VK_PIPE` Constant for the "|" key
    `static short` | `VK_PLUS` Constant for the "+" key.
    `static short` | `VK_PREVIOUS_CANDIDATE` Constant for the Previous Candidate function key.
    `static short` | `VK_PRINTSCREEN` Constant for the PRINT function key.
    `static short` | `VK_PROPS`
    `static short` | `VK_Q` See `VK_A`.
    `static short` | `VK_QUESTIONMARK` Constant for the equals key, "?"
    `static short` | `VK_QUOTE` Constant for the "'" key.
    `static short` | `VK_QUOTEDBL` Constant for the """ key.
    `static short` | `VK_R` See `VK_A`.
    `static short` | `VK_RIGHT` Constant for the cursor- or numerical-pad right arrow key.
    `static short` | `VK_RIGHT_BRACE` Constant for the "}" key
    `static short` | `VK_RIGHT_PARENTHESIS` Constant for the ")" key.
    `static short` | `VK_ROMAN_CHARACTERS` Constant for the Roman Characters function key.
    `static short` | `VK_S` See `VK_A`.
    `static short` | `VK_SCROLL_LOCK` scroll lock key.
    `static short` | `VK_SEMICOLON` Constant for the semicolon key, ";"
    `static short` | `VK_SEPARATOR` Numeric keypad decimal separator key.
    `static short` | `VK_SHIFT` Constant for the CTRL function key.
    `static short` | `VK_SLASH` Constant for the forward slash key, "/"
    `static short` | `VK_SPACE` Constant for the SPACE function key.
    `static short` | `VK_STOP` Constant for the Stop function key.
    `static short` | `VK_SUBTRACT` Numeric keypad subtract key.
    `static short` | `VK_T` See `VK_A`.
    `static short` | `VK_TAB` Constant for the HORIZ TAB key "\t", matching ASCII.
    `static short` | `VK_TILDE` Constant for the "~" key, matching ASCII
    `static short` | `VK_U` See `VK_A`.
    `static short` | `VK_UNDEFINED` This value, 0, is used to indicate that the keyCode is unknown.
    `static short` | `VK_UNDERSCORE` Constant for the "_" key
    `static short` | `VK_UNDO`
    `static short` | `VK_UP` Constant for the cursor- or numerical-pad up arrow key.
    `static short` | `VK_V` See `VK_A`.
    `static short` | `VK_W` See `VK_A`.
    `static short` | `VK_WINDOWS` Constant for the MS "Windows" function key.
    `static short` | `VK_X` See `VK_A`.
    `static short` | `VK_Y` See `VK_A`.
    `static short` | `VK_Z` See `VK_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

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static KeyEvent` | `create(short eventType, Object source, long when, int modifiers, short keyCode, short keySym, char keyChar)`
    `static String` | `getEventTypeString(short type)`
    `char` | `getKeyChar()` Returns the UTF-16 character reflecting the `key symbol` incl.
    `short` | `getKeyCode()` Returns the virtual key code using a fixed mapping to the US keyboard layout.
    `short` | `getKeySymbol()` Returns the virtual key symbol reflecting the current keyboard layout.
    `static int` | `getModifierMask(short vKey)` If `vKey` is a `modifier key`, method returns the corresponding modifier mask, otherwise 0.
    `boolean` | `isActionKey()` Returns `true` if `key symbol` represents a non-printable and non-`modifier` action key, otherwise `false`.
    `boolean` | `isModifierKey()` Returns `true` if `key symbol` represents a modifier key, otherwise `false`.
    `static boolean` | `isModifierKey(short vKey)` Returns `true` if the given `virtualKey` represents a modifier key, otherwise `false`.
    `boolean` | `isPrintableKey()` Returns `true` if `key symbol` and `key char` represents a printable character, i.e.
    `static boolean` | `isPrintableKey(short uniChar, boolean isKeyChar)` Returns `true` if given `uniChar` represents a printable character, i.e.
    `String` | `toString()`
    `StringBuilder` | `toString(StringBuilder sb)`
    `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`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### EVENT_KEY_PRESSED

          public static final short EVENT_KEY_PRESSED

      A key has been pressed, excluding `auto-repeat`-`modifier` keys.
      See Also:
        Constant Field Values

    - #### EVENT_KEY_RELEASED

          public static final short EVENT_KEY_RELEASED

      A key has been released, excluding `auto-repeat`-`modifier` keys.
      See Also:
        Constant Field Values

    - #### NULL_CHAR

          public static final char NULL_CHAR

      This value, `'\0'`, is used to indicate that the keyChar is unknown or not printable.
      See Also:
        Constant Field Values

    - #### nonPrintableKeys

          public static final KeyEvent.NonPrintableRange[] nonPrintableKeys

      Non printable key ranges, currently fixed to an array of size 4.

      Not included, queried upfront:

      - `VK_BACK_SPACE`
      - `VK_TAB`
      - `VK_ENTER`

    - #### VK_UNDEFINED

          public static final short VK_UNDEFINED

      This value, 0, is used to indicate that the keyCode is unknown.
      See Also:
        Constant Field Values

    - #### VK_HOME

          public static final short VK_HOME

      Constant for the HOME function key. ASCII: Start Of Text.
      See Also:
        Constant Field Values

    - #### VK_END

          public static final short VK_END

      Constant for the END function key. ASCII: End Of Text.
      See Also:
        Constant Field Values

    - #### VK_FINAL

          public static final short VK_FINAL

      Constant for the END function key. ASCII: End Of Transmission.
      See Also:
        Constant Field Values

    - #### VK_PRINTSCREEN

          public static final short VK_PRINTSCREEN

      Constant for the PRINT function key. ASCII: Enquiry.
      See Also:
        Constant Field Values

    - #### VK_BACK_SPACE

          public static final short VK_BACK_SPACE

      Constant for the BACK SPACE key "\b", matching ASCII. Printable!
      See Also:
        Constant Field Values

    - #### VK_TAB

          public static final short VK_TAB

      Constant for the HORIZ TAB key "\t", matching ASCII. Printable!
      See Also:
        Constant Field Values

    - #### VK_PAGE_DOWN

          public static final short VK_PAGE_DOWN

      Constant for the PAGE DOWN function key. ASCII: Vertical Tabulation.
      See Also:
        Constant Field Values

    - #### VK_CLEAR

          public static final short VK_CLEAR

      Constant for the CLEAR key, i.e. FORM FEED, matching ASCII.
      See Also:
        Constant Field Values

    - #### VK_ENTER

          public static final short VK_ENTER

      Constant for the ENTER key, i.e. CARRIAGE RETURN, matching ASCII. Printable!
      See Also:
        Constant Field Values

    - #### VK_SHIFT

          public static final short VK_SHIFT

      Constant for the CTRL function key. ASCII: shift-in.
      See Also:
        Constant Field Values

    - #### VK_PAGE_UP

          public static final short VK_PAGE_UP

      Constant for the PAGE UP function key. ASCII: Data Link Escape.
      See Also:
        Constant Field Values

    - #### VK_CONTROL

          public static final short VK_CONTROL

      Constant for the CTRL function key. ASCII: device-ctrl-one.
      See Also:
        Constant Field Values

    - #### VK_ALT

          public static final short VK_ALT

      Constant for the left ALT function key. ASCII: device-ctrl-two.
      See Also:
        Constant Field Values

    - #### VK_ALT_GRAPH

          public static final short VK_ALT_GRAPH

      Constant for the ALT_GRAPH function key, i.e. right ALT key. ASCII: device-ctrl-three.
      See Also:
        Constant Field Values

    - #### VK_CAPS_LOCK

          public static final short VK_CAPS_LOCK

      Constant for the CAPS LOCK function key. ASCII: device-ctrl-four.
      See Also:
        Constant Field Values

    - #### VK_PAUSE

          public static final short VK_PAUSE

      Constant for the PAUSE function key. ASCII: sync-idle.
      See Also:
        Constant Field Values

    - #### VK_SCROLL_LOCK

          public static final short VK_SCROLL_LOCK

      scroll lock key. ASCII: End Of Transmission Block.
      See Also:
        Constant Field Values

    - #### VK_CANCEL

          public static final short VK_CANCEL

      Constant for the CANCEL function key. ASCII: Cancel.
      See Also:
        Constant Field Values

    - #### VK_INSERT

          public static final short VK_INSERT

      Constant for the INSERT function key. ASCII: Substitute.
      See Also:
        Constant Field Values

    - #### VK_ESCAPE

          public static final short VK_ESCAPE

      Constant for the ESCAPE function key. ASCII: Escape.
      See Also:
        Constant Field Values

    - #### VK_CONVERT

          public static final short VK_CONVERT

      Constant for the Convert function key, Japanese "henkan". ASCII: File Separator.
      See Also:
        Constant Field Values

    - #### VK_NONCONVERT

          public static final short VK_NONCONVERT

      Constant for the Don't Convert function key, Japanese "muhenkan". ASCII: Group Separator.
      See Also:
        Constant Field Values

    - #### VK_ACCEPT

          public static final short VK_ACCEPT

      Constant for the Accept or Commit function key, Japanese "kakutei". ASCII: Record Separator.
      See Also:
        Constant Field Values

    - #### VK_MODECHANGE

          public static final short VK_MODECHANGE

      Constant for the Mode Change (?). ASCII: Unit Separator.
      See Also:
        Constant Field Values

    - #### VK_SPACE

          public static final short VK_SPACE

      Constant for the SPACE function key. ASCII: SPACE.
      See Also:
        Constant Field Values

    - #### VK_EXCLAMATION_MARK

          public static final short VK_EXCLAMATION_MARK

      Constant for the "!" key.
      See Also:
        Constant Field Values

    - #### VK_QUOTEDBL

          public static final short VK_QUOTEDBL

      Constant for the """ key.
      See Also:
        Constant Field Values

    - #### VK_NUMBER_SIGN

          public static final short VK_NUMBER_SIGN

      Constant for the "#" key.
      See Also:
        Constant Field Values

    - #### VK_DOLLAR

          public static final short VK_DOLLAR

      Constant for the "$" key.
      See Also:
        Constant Field Values

    - #### VK_PERCENT

          public static final short VK_PERCENT

      Constant for the "%" key.
      See Also:
        Constant Field Values

    - #### VK_AMPERSAND

          public static final short VK_AMPERSAND

      Constant for the "&" key.
      See Also:
        Constant Field Values

    - #### VK_QUOTE

          public static final short VK_QUOTE

      Constant for the "'" key.
      See Also:
        Constant Field Values

    - #### VK_LEFT_PARENTHESIS

          public static final short VK_LEFT_PARENTHESIS

      Constant for the "(" key.
      See Also:
        Constant Field Values

    - #### VK_RIGHT_PARENTHESIS

          public static final short VK_RIGHT_PARENTHESIS

      Constant for the ")" key.
      See Also:
        Constant Field Values

    - #### VK_ASTERISK

          public static final short VK_ASTERISK

      Constant for the "*" key
      See Also:
        Constant Field Values

    - #### VK_PLUS

          public static final short VK_PLUS

      Constant for the "+" key.
      See Also:
        Constant Field Values

    - #### VK_COMMA

          public static final short VK_COMMA

      Constant for the comma key, ","
      See Also:
        Constant Field Values

    - #### VK_MINUS

          public static final short VK_MINUS

      Constant for the minus key, "-"
      See Also:
        Constant Field Values

    - #### VK_PERIOD

          public static final short VK_PERIOD

      Constant for the period key, "."
      See Also:
        Constant Field Values

    - #### VK_SLASH

          public static final short VK_SLASH

      Constant for the forward slash key, "/"
      See Also:
        Constant Field Values

    - #### VK_0

          public static final short VK_0

      VK_0 thru VK_9 are the same as UTF16/ASCII '0' thru '9' [0x30 - 0x39]
      See Also:
        Constant Field Values

    - #### VK_1

          public static final short VK_1

      See `VK_0`.
      See Also:
        Constant Field Values

    - #### VK_2

          public static final short VK_2

      See `VK_0`.
      See Also:
        Constant Field Values

    - #### VK_3

          public static final short VK_3

      See `VK_0`.
      See Also:
        Constant Field Values

    - #### VK_4

          public static final short VK_4

      See `VK_0`.
      See Also:
        Constant Field Values

    - #### VK_5

          public static final short VK_5

      See `VK_0`.
      See Also:
        Constant Field Values

    - #### VK_6

          public static final short VK_6

      See `VK_0`.
      See Also:
        Constant Field Values

    - #### VK_7

          public static final short VK_7

      See `VK_0`.
      See Also:
        Constant Field Values

    - #### VK_8

          public static final short VK_8

      See `VK_0`.
      See Also:
        Constant Field Values

    - #### VK_9

          public static final short VK_9

      See `VK_0`.
      See Also:
        Constant Field Values

    - #### VK_COLON

          public static final short VK_COLON

      Constant for the ":" key.
      See Also:
        Constant Field Values

    - #### VK_SEMICOLON

          public static final short VK_SEMICOLON

      Constant for the semicolon key, ";"
      See Also:
        Constant Field Values

    - #### VK_LESS

          public static final short VK_LESS

      Constant for the equals key, "<"
      See Also:
        Constant Field Values

    - #### VK_EQUALS

          public static final short VK_EQUALS

      Constant for the equals key, "="
      See Also:
        Constant Field Values

    - #### VK_GREATER

          public static final short VK_GREATER

      Constant for the equals key, ">"
      See Also:
        Constant Field Values

    - #### VK_QUESTIONMARK

          public static final short VK_QUESTIONMARK

      Constant for the equals key, "?"
      See Also:
        Constant Field Values

    - #### VK_AT

          public static final short VK_AT

      Constant for the equals key, "@"
      See Also:
        Constant Field Values

    - #### VK_A

          public static final short VK_A

      VK_A thru VK_Z are the same as Capital UTF16/ASCII 'A' thru 'Z' (0x41 - 0x5A)
      See Also:
        Constant Field Values

    - #### VK_B

          public static final short VK_B

      See `VK_A`.
      See Also:
        Constant Field Values

    - #### VK_C

          public static final short VK_C

      See `VK_A`.
      See Also:
        Constant Field Values

    - #### VK_D

          public static final short VK_D

      See `VK_A`.
      See Also:
        Constant Field Values

    - #### VK_E

          public static final short VK_E

      See `VK_A`.
      See Also:
        Constant Field Values

    - #### VK_F

          public static final short VK_F

      See `VK_A`.
      See Also:
        Constant Field Values

    - #### VK_G

          public static final short VK_G

      See `VK_A`.
      See Also:
        Constant Field Values

    - #### VK_H

          public static final short VK_H

      See `VK_A`.
      See Also:
        Constant Field Values

    - #### VK_I

          public static final short VK_I

      See `VK_A`.
      See Also:
        Constant Field Values

    - #### VK_J

          public static final short VK_J

      See `VK_A`.
      See Also:
        Constant Field Values

    - #### VK_K

          public static final short VK_K

      See `VK_A`.
      See Also:
        Constant Field Values

    - #### VK_L

          public static final short VK_L

      See `VK_A`.
      See Also:
        Constant Field Values

    - #### VK_M

          public static final short VK_M

      See `VK_A`.
      See Also:
        Constant Field Values

    - #### VK_N

          public static final short VK_N

      See `VK_A`.
      See Also:
        Constant Field Values

    - #### VK_O

          public static final short VK_O

      See `VK_A`.
      See Also:
        Constant Field Values

    - #### VK_P

          public static final short VK_P

      See `VK_A`.
      See Also:
        Constant Field Values

    - #### VK_Q

          public static final short VK_Q

      See `VK_A`.
      See Also:
        Constant Field Values

    - #### VK_R

          public static final short VK_R

      See `VK_A`.
      See Also:
        Constant Field Values

    - #### VK_S

          public static final short VK_S

      See `VK_A`.
      See Also:
        Constant Field Values

    - #### VK_T

          public static final short VK_T

      See `VK_A`.
      See Also:
        Constant Field Values

    - #### VK_U

          public static final short VK_U

      See `VK_A`.
      See Also:
        Constant Field Values

    - #### VK_V

          public static final short VK_V

      See `VK_A`.
      See Also:
        Constant Field Values

    - #### VK_W

          public static final short VK_W

      See `VK_A`.
      See Also:
        Constant Field Values

    - #### VK_X

          public static final short VK_X

      See `VK_A`.
      See Also:
        Constant Field Values

    - #### VK_Y

          public static final short VK_Y

      See `VK_A`.
      See Also:
        Constant Field Values

    - #### VK_Z

          public static final short VK_Z

      See `VK_A`.
      See Also:
        Constant Field Values

    - #### VK_OPEN_BRACKET

          public static final short VK_OPEN_BRACKET

      Constant for the open bracket key, "["
      See Also:
        Constant Field Values

    - #### VK_BACK_SLASH

          public static final short VK_BACK_SLASH

      Constant for the back slash key, "\"
      See Also:
        Constant Field Values

    - #### VK_CLOSE_BRACKET

          public static final short VK_CLOSE_BRACKET

      Constant for the close bracket key, "]"
      See Also:
        Constant Field Values

    - #### VK_CIRCUMFLEX

          public static final short VK_CIRCUMFLEX

      Constant for the "^" key.
      See Also:
        Constant Field Values

    - #### VK_UNDERSCORE

          public static final short VK_UNDERSCORE

      Constant for the "_" key
      See Also:
        Constant Field Values

    - #### VK_BACK_QUOTE

          public static final short VK_BACK_QUOTE

      Constant for the "`" key
      See Also:
        Constant Field Values

    - #### VK_F1

          public static final short VK_F1

      Constant 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:
        Constant Field Values

    - #### VK_F2

          public static final short VK_F2

      Constant for the F2 function key. See `VK_F1`.
      See Also:
        Constant Field Values

    - #### VK_F3

          public static final short VK_F3

      Constant for the F3 function key. See `VK_F1`.
      See Also:
        Constant Field Values

    - #### VK_F4

          public static final short VK_F4

      Constant for the F4 function key. See `VK_F1`.
      See Also:
        Constant Field Values

    - #### VK_F5

          public static final short VK_F5

      Constant for the F5 function key. See `VK_F1`.
      See Also:
        Constant Field Values

    - #### VK_F6

          public static final short VK_F6

      Constant for the F6 function key. See `VK_F1`.
      See Also:
        Constant Field Values

    - #### VK_F7

          public static final short VK_F7

      Constant for the F7 function key. See `VK_F1`.
      See Also:
        Constant Field Values

    - #### VK_F8

          public static final short VK_F8

      Constant for the F8 function key. See `VK_F1`.
      See Also:
        Constant Field Values

    - #### VK_F9

          public static final short VK_F9

      Constant for the F9 function key. See `VK_F1`.
      See Also:
        Constant Field Values

    - #### VK_F10

          public static final short VK_F10

      Constant for the F11 function key. See `VK_F1`.
      See Also:
        Constant Field Values

    - #### VK_F11

          public static final short VK_F11

      Constant for the F11 function key. See `VK_F1`.
      See Also:
        Constant Field Values

    - #### VK_F12

          public static final short VK_F12

      Constant for the F12 function key. See `VK_F1`.
      See Also:
        Constant Field Values

    - #### VK_F13

          public static final short VK_F13

      Constant for the F13 function key. See `VK_F1`.
      See Also:
        Constant Field Values

    - #### VK_F14

          public static final short VK_F14

      Constant for the F14 function key. See `VK_F1`.
      See Also:
        Constant Field Values

    - #### VK_F15

          public static final short VK_F15

      Constant for the F15 function key. See `VK_F1`.
      See Also:
        Constant Field Values

    - #### VK_F16

          public static final short VK_F16

      Constant for the F16 function key. See `VK_F1`.
      See Also:
        Constant Field Values

    - #### VK_F17

          public static final short VK_F17

      Constant for the F17 function key. See `VK_F1`.
      See Also:
        Constant Field Values

    - #### VK_F18

          public static final short VK_F18

      Constant for the F18 function key. See `VK_F1`.
      See Also:
        Constant Field Values

    - #### VK_F19

          public static final short VK_F19

      Constant for the F19 function key. See `VK_F1`.
      See Also:
        Constant Field Values

    - #### VK_F20

          public static final short VK_F20

      Constant for the F20 function key. See `VK_F1`.
      See Also:
        Constant Field Values

    - #### VK_F21

          public static final short VK_F21

      Constant for the F21 function key. See `VK_F1`.
      See Also:
        Constant Field Values

    - #### VK_F22

          public static final short VK_F22

      Constant for the F22 function key. See `VK_F1`.
      See Also:
        Constant Field Values

    - #### VK_F23

          public static final short VK_F23

      Constant for the F23 function key. See `VK_F1`.
      See Also:
        Constant Field Values

    - #### VK_F24

          public static final short VK_F24

      Constant for the F24 function key. See `VK_F1`.
      See Also:
        Constant Field Values

    - #### VK_LEFT_BRACE

          public static final short VK_LEFT_BRACE

      Constant for the "{" key
      See Also:
        Constant Field Values

    - #### VK_PIPE

          public static final short VK_PIPE

      Constant for the "|" key
      See Also:
        Constant Field Values

    - #### VK_RIGHT_BRACE

          public static final short VK_RIGHT_BRACE

      Constant for the "}" key
      See Also:
        Constant Field Values

    - #### VK_TILDE

          public static final short VK_TILDE

      Constant for the "~" key, matching ASCII
      See Also:
        Constant Field Values

    - #### VK_SEPARATOR

          public static final short VK_SEPARATOR

      Numeric keypad decimal separator key. Non printable UTF control.
      See Also:
        Constant Field Values

    - #### VK_NUMPAD0

          public static final short VK_NUMPAD0

      Numeric keypad VK_NUMPAD0 thru VK_NUMPAD9 are mapped to UTF control (0x80 - 0x89). Non printable UTF control.
      See Also:
        Constant Field Values

    - #### VK_NUMPAD1

          public static final short VK_NUMPAD1

      See `VK_NUMPAD0`.
      See Also:
        Constant Field Values

    - #### VK_NUMPAD2

          public static final short VK_NUMPAD2

      See `VK_NUMPAD0`.
      See Also:
        Constant Field Values

    - #### VK_NUMPAD3

          public static final short VK_NUMPAD3

      See `VK_NUMPAD0`.
      See Also:
        Constant Field Values

    - #### VK_NUMPAD4

          public static final short VK_NUMPAD4

      See `VK_NUMPAD0`.
      See Also:
        Constant Field Values

    - #### VK_NUMPAD5

          public static final short VK_NUMPAD5

      See `VK_NUMPAD0`.
      See Also:
        Constant Field Values

    - #### VK_NUMPAD6

          public static final short VK_NUMPAD6

      See `VK_NUMPAD0`.
      See Also:
        Constant Field Values

    - #### VK_NUMPAD7

          public static final short VK_NUMPAD7

      See `VK_NUMPAD0`.
      See Also:
        Constant Field Values

    - #### VK_NUMPAD8

          public static final short VK_NUMPAD8

      See `VK_NUMPAD0`.
      See Also:
        Constant Field Values

    - #### VK_NUMPAD9

          public static final short VK_NUMPAD9

      See `VK_NUMPAD0`.
      See Also:
        Constant Field Values

    - #### VK_DECIMAL

          public static final short VK_DECIMAL

      Numeric keypad decimal separator key. Non printable UTF control.
      See Also:
        Constant Field Values

    - #### VK_ADD

          public static final short VK_ADD

      Numeric keypad add key. Non printable UTF control.
      See Also:
        Constant Field Values

    - #### VK_SUBTRACT

          public static final short VK_SUBTRACT

      Numeric keypad subtract key. Non printable UTF control.
      See Also:
        Constant Field Values

    - #### VK_MULTIPLY

          public static final short VK_MULTIPLY

      Numeric keypad multiply key. Non printable UTF control.
      See Also:
        Constant Field Values

    - #### VK_DIVIDE

          public static final short VK_DIVIDE

      Numeric keypad divide key. Non printable UTF control.
      See Also:
        Constant Field Values

    - #### VK_DELETE

          public static final short VK_DELETE

      Constant for the DEL key, matching ASCII. Non printable UTF control.
      See Also:
        Constant Field Values

    - #### VK_NUM_LOCK

          public static final short VK_NUM_LOCK

      Numeric keypad num lock key. Non printable UTF control.
      See Also:
        Constant Field Values

    - #### VK_LEFT

          public static final short VK_LEFT

      Constant for the cursor- or numerical-pad left arrow key. Non printable UTF control.
      See Also:
        Constant Field Values

    - #### VK_UP

          public static final short VK_UP

      Constant for the cursor- or numerical-pad up arrow key. Non printable UTF control.
      See Also:
        Constant Field Values

    - #### VK_RIGHT

          public static final short VK_RIGHT

      Constant for the cursor- or numerical-pad right arrow key. Non printable UTF control.
      See Also:
        Constant Field Values

    - #### VK_DOWN

          public static final short VK_DOWN

      Constant for the cursor- or numerical pad down arrow key. Non printable UTF control.
      See Also:
        Constant Field Values

    - #### VK_CONTEXT_MENU

          public static final short VK_CONTEXT_MENU

      Constant for the Context Menu key. Non printable UTF control.
      See Also:
        Constant Field Values

    - #### VK_WINDOWS

          public static final short VK_WINDOWS

      Constant for the MS "Windows" function key. It is used for both the left and right version of the key.
      See Also:
        Constant Field Values

    - #### VK_META

          public static final short VK_META

      Constant for the Meta function key.
      See Also:
        Constant Field Values

    - #### VK_HELP

          public static final short VK_HELP

      Constant for the Help function key.
      See Also:
        Constant Field Values

    - #### VK_COMPOSE

          public static final short VK_COMPOSE

      Constant for the Compose function key.
      See Also:
        Constant Field Values

    - #### VK_BEGIN

          public static final short VK_BEGIN

      Constant for the Begin function key.
      See Also:
        Constant Field Values

    - #### VK_STOP

          public static final short VK_STOP

      Constant for the Stop function key.
      See Also:
        Constant Field Values

    - #### VK_INVERTED_EXCLAMATION_MARK

          public static final short VK_INVERTED_EXCLAMATION_MARK

      Constant for the inverted exclamation mark key.
      See Also:
        Constant Field Values

    - #### VK_EURO_SIGN

          public static final short VK_EURO_SIGN

      Constant for the Euro currency sign key.
      See Also:
        Constant Field Values

    - #### VK_CUT

          public static final short VK_CUT

      See Also:
        Constant Field Values

    - #### VK_COPY

          public static final short VK_COPY

      See Also:
        Constant Field Values

    - #### VK_PASTE

          public static final short VK_PASTE

      See Also:
        Constant Field Values

    - #### VK_UNDO

          public static final short VK_UNDO

      See Also:
        Constant Field Values

    - #### VK_AGAIN

          public static final short VK_AGAIN

      See Also:
        Constant Field Values

    - #### VK_FIND

          public static final short VK_FIND

      See Also:
        Constant Field Values

    - #### VK_PROPS

          public static final short VK_PROPS

      See Also:
        Constant Field Values

    - #### VK_INPUT_METHOD_ON_OFF

          public static final short VK_INPUT_METHOD_ON_OFF

      Constant for the input method on/off key.
      See Also:
        Constant Field Values

    - #### VK_CODE_INPUT

          public static final short VK_CODE_INPUT

      Constant for the Code Input function key.
      See Also:
        Constant Field Values

    - #### VK_ROMAN_CHARACTERS

          public static final short VK_ROMAN_CHARACTERS

      Constant for the Roman Characters function key.
      See Also:
        Constant Field Values

    - #### VK_ALL_CANDIDATES

          public static final short VK_ALL_CANDIDATES

      Constant for the All Candidates function key.
      See Also:
        Constant Field Values

    - #### VK_PREVIOUS_CANDIDATE

          public static final short VK_PREVIOUS_CANDIDATE

      Constant for the Previous Candidate function key.
      See Also:
        Constant Field Values

    - #### VK_ALPHANUMERIC

          public static final short VK_ALPHANUMERIC

      Constant for the Alphanumeric function key.
      See Also:
        Constant Field Values

    - #### VK_KATAKANA

          public static final short VK_KATAKANA

      Constant for the Katakana function key.
      See Also:
        Constant Field Values

    - #### VK_HIRAGANA

          public static final short VK_HIRAGANA

      Constant for the Hiragana function key.
      See Also:
        Constant Field Values

    - #### VK_FULL_WIDTH

          public static final short VK_FULL_WIDTH

      Constant for the Full-Width Characters function key.
      See Also:
        Constant Field Values

    - #### VK_HALF_WIDTH

          public static final short VK_HALF_WIDTH

      Constant for the Half-Width Characters function key.
      See Also:
        Constant Field Values

    - #### VK_JAPANESE_KATAKANA

          public static final short VK_JAPANESE_KATAKANA

      Constant for the Japanese-Katakana function key. This key switches to a Japanese input method and selects its Katakana input mode.
      See Also:
        Constant Field Values

    - #### VK_JAPANESE_HIRAGANA

          public static final short VK_JAPANESE_HIRAGANA

      Constant for the Japanese-Hiragana function key. This key switches to a Japanese input method and selects its Hiragana input mode.
      See Also:
        Constant Field Values

    - #### VK_JAPANESE_ROMAN

          public static final short VK_JAPANESE_ROMAN

      Constant for the Japanese-Roman function key. This key switches to a Japanese input method and selects its Roman-Direct input mode.
      See Also:
        Constant Field Values

    - #### VK_KANA_LOCK

          public static final short VK_KANA_LOCK

      Constant for the locking Kana function key. This key locks the keyboard into a Kana layout.
      See Also:
        Constant Field Values

    - #### VK_KEYBOARD_INVISIBLE

          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.
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### create

          public static KeyEvent create(short eventType,
                        Object source,
                        long when,
                        int modifiers,
                        short keyCode,
                        short keySym,
                        char keyChar)

    - #### getKeyChar

          public final char getKeyChar()

      Returns the UTF-16 character reflecting the `key symbol` incl. active `modifiers`.
      See Also:
        `getKeySymbol()`, `getKeyCode()`

    - #### getKeySymbol

          public final short getKeySymbol()

      Returns the virtual key symbol reflecting the current keyboard layout.

      For `printable keys`, the key symbol is the `unmodified` representation of the UTF-16 `key char`.
      E.g. symbol [`VK_A`, 'A'] for char 'a'.

      See Also:
        `isPrintableKey()`, `getKeyChar()`, `getKeyCode()`

    - #### 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 layout `QWERTY` or `QWERTZ` is active. The `key symbol` of the former is `VK_Y`, where the latter produces `VK_Y`.

      See Also:
        `getKeyChar()`, `getKeySymbol()`

    - #### toString

          public final String toString()

      Overrides:
        `toString` in class `InputEvent`

    - #### toString

          public final StringBuilder toString(StringBuilder sb)

      Overrides:
        `toString` in class `InputEvent`

    - #### getEventTypeString

          public static String getEventTypeString(short type)

    - #### utf16ToVKey

          public static short utf16ToVKey(char keyChar)

      Parameters:
        `keyChar` - UTF16 value to map. It is expected that the incoming keyChar value is unshifted and unmodified, however, lower case a-z is mapped to `VK_A` - `VK_Z`.
      Returns:
        `KeyEvent` virtual key (VK) value.

    - #### isModifierKey

          public static boolean isModifierKey(short vKey)

      Returns `true` if the given `virtualKey` represents a modifier key, otherwise `false`.

      A modifier key is one of `VK_SHIFT`, `VK_CONTROL`, `VK_ALT`, `VK_ALT_GRAPH`, `VK_META`.

    - #### getModifierMask

          public static int getModifierMask(short vKey)

      If `vKey` is a `modifier key`, method returns the corresponding modifier mask, otherwise 0.

    - #### isModifierKey

          public final boolean isModifierKey()

      Returns `true` if `key symbol` represents a modifier key, otherwise `false`.

      See `isModifierKey(short)` for details.

      Note: Implementation uses a cached value.

    - #### isActionKey

          public final boolean isActionKey()

      Returns `true` if `key symbol` represents a non-printable and non-`modifier` action key, otherwise `false`.

      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()`, `isModifierKey()`

    - #### isPrintableKey

          public static boolean isPrintableKey(short uniChar,
                               boolean isKeyChar)

      Returns `true` if given `uniChar` represents a printable character, i.e. a value other than `VK_UNDEFINED` and not a control or non-printable private code.

      A printable character is neither a `modifier key`, nor an `action 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 if `uniChar` is a key character, otherwise a virtual key code

    - #### isPrintableKey

          public final boolean isPrintableKey()

      Returns `true` if `key symbol` and `key char` represents a printable character, i.e. a value other than `VK_UNDEFINED` and not a control or non-printable private code.

      A printable character is neither a `modifier key`, nor an `action key`.

      Otherwise returns `false`.

Copyright 2010 JogAmp Community.