KeyCodes (GWT Javadoc)

Overview | Package | Class | Use | Deprecated | Help
| GWT 2.7.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.google.gwt.event.dom.client
Class KeyCodes

    java.lang.Object
      com.google.gwt.event.dom.client.KeyCodes

    public class KeyCodes

extends java.lang.Object

Contains the native key codes previously defined in `KeyboardListener`. When converting keyboard listener instances, developers can use the following static import to access these constants:

     import static com.google.gwt.event.dom.client.KeyCodes.*;

These constants are defined with an int data type in order to be compatible with the constants defined in `KeyboardListener`.

Field Summary
`static int` | `KEY_A` Key code for A
`static int` | `KEY_ALT` Alt key code.
`static int` | `KEY_B` Key code for B
`static int` | `KEY_BACKSPACE` Backspace key code.
`static int` | `KEY_C` Key code for C
`static int` | `KEY_CAPS_LOCK` Key code for caps lock key
`static int` | `KEY_CONTEXT_MENU` Key code for context menu key.
`static int` | `KEY_CTRL` Control key code.
`static int` | `KEY_D` Key code for D
`static int` | `KEY_DELETE` Delete key code (also numeric keypad delete).
`static int` | `KEY_DOWN` Down arrow code (Also numeric keypad down).
`static int` | `KEY_E` Key code for E
`static int` | `KEY_EIGHT` Key code number 8
`static int` | `KEY_END` End key code (Also numeric keypad south west).
`static int` | `KEY_ENTER` Enter key code.
`static int` | `KEY_ESCAPE` Escape key code.
`static int` | `KEY_F` Key code for F
`static int` | `KEY_F1` Key code for F1
`static int` | `KEY_F10` Key code for F10
`static int` | `KEY_F11` Key code for F11
`static int` | `KEY_F12` Key code for F12
`static int` | `KEY_F2` Key code for F2
`static int` | `KEY_F3` Key code for F3
`static int` | `KEY_F4` Key code for F4
`static int` | `KEY_F5` Key code for F5
`static int` | `KEY_F6` Key code for F6
`static int` | `KEY_F7` Key code for F7
`static int` | `KEY_F8` Key code for F8
`static int` | `KEY_F9` Key code for F9
`static int` | `KEY_FIRST_MEDIA_KEY` Key code for first OS specific media key (like volume).
`static int` | `KEY_FIVE` Key code number 5
`static int` | `KEY_FOUR` Key code number 4
`static int` | `KEY_G` Key code for G
`static int` | `KEY_H` Key code for H
`static int` | `KEY_HOME` Home key code (Also numeric keypad north west).
`static int` | `KEY_I` Key code for I
`static int` | `KEY_INSERT` Key code for insert key (Also numeric keyboard insert).
`static int` | `KEY_J` Key code for J
`static int` | `KEY_K` Key code for K
`static int` | `KEY_L` Key code for L
`static int` | `KEY_LAST_MEDIA_KEY` Key code for last OS specific media key (like volume).
`static int` | `KEY_LEFT` Left key code (Also numeric keypad west).
`static int` | `KEY_M` Key code for M
`static int` | `KEY_MAC_ENTER` Key code for Mac enter key
`static int` | `KEY_MAC_FF_META` Key code for `KEY_WIN_KEY_LEFT_META` that Firefox fires for the meta key.
`static int` | `KEY_N` Key code for N
`static int` | `KEY_NINE` Key code number 9
`static int` | `KEY_NUM_CENTER` Key code for insert key (Also num lock on FF,Safari Mac).
`static int` | `KEY_NUM_DIVISION` Key code for division on numeric keyboard
`static int` | `KEY_NUM_EIGHT` Key code for number 8 on numeric keyboard
`static int` | `KEY_NUM_FIVE` Key code for number 5 on numeric keyboard
`static int` | `KEY_NUM_FOUR` Key code for number 4 on numeric keyboard
`static int` | `KEY_NUM_MINUS` Key code for minus on numeric keyboard
`static int` | `KEY_NUM_MULTIPLY` Key code for multiply on numeric keyboard
`static int` | `KEY_NUM_NINE` Key code for number 9 on numeric keyboard
`static int` | `KEY_NUM_ONE` Key code for number 1 on numeric keyboard
`static int` | `KEY_NUM_PERIOD` Key code for period on numeric keyboard
`static int` | `KEY_NUM_PLUS` Key code for plus on numeric keyboard
`static int` | `KEY_NUM_SEVEN` Key code for number 7 on numeric keyboard
`static int` | `KEY_NUM_SIX` Key code for number 6 on numeric keyboard
`static int` | `KEY_NUM_THREE` Key code for number 3 on numeric keyboard
`static int` | `KEY_NUM_TWO` Key code for number 2 on numeric keyboard
`static int` | `KEY_NUM_ZERO` Key code for number 0 on numeric keyboard
`static int` | `KEY_NUMLOCK` Key code for num lock.
`static int` | `KEY_O` Key code for O
`static int` | `KEY_ONE` Key code number 1
`static int` | `KEY_P` Key code for P
`static int` | `KEY_PAGEDOWN` Page down key code (Also numeric keypad south east).
`static int` | `KEY_PAGEUP` Page up key code (Also numeric keypad north east).
`static int` | `KEY_PAUSE` Key code for pause key
`static int` | `KEY_PRINT_SCREEN` Key code for print key
`static int` | `KEY_Q` Key code for Q
`static int` | `KEY_R` Key code for R
`static int` | `KEY_RIGHT` Right arrow key code (Also numeric keypad east).
`static int` | `KEY_S` Key code for S
`static int` | `KEY_SCROLL_LOCK` Key code for scroll lock.
`static int` | `KEY_SEVEN` Key code number 7
`static int` | `KEY_SHIFT` Shift key code.
`static int` | `KEY_SIX` Key code number 6
`static int` | `KEY_SPACE` Key code for space
`static int` | `KEY_T` Key code for T
`static int` | `KEY_TAB` Tab key code.
`static int` | `KEY_THREE` Key code number 3
`static int` | `KEY_TWO` Key code number 2
`static int` | `KEY_U` Key code for U
`static int` | `KEY_UP` Up Arrow key code (Also numeric keypad north).
`static int` | `KEY_V` Key code for V
`static int` | `KEY_W` Key code for W
`static int` | `KEY_WIN_IME` Key code for IME.
`static int` | `KEY_WIN_KEY` Key code for left windows key.
`static int` | `KEY_WIN_KEY_FF_LINUX` Key code for Windows key on Firefox Linux
`static int` | `KEY_WIN_KEY_LEFT_META` Key code for left windows key or meta.
`static int` | `KEY_WIN_KEY_RIGHT` Key code for right windows key.
`static int` | `KEY_X` Key code for X
`static int` | `KEY_Y` Key code for Y
`static int` | `KEY_Z` Key code for Z
`static int` | `KEY_ZERO` Key code number 0

Method Summary
`static boolean` | `isArrowKey(int code)` Determines if a key code is an arrow key.
`static int` | `maybeSwapArrowKeysForRtl(int code, boolean isRtl)` Update arrow keys for left and right based on current locale.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### KEY_A

    public static final int KEY_A

  Key code for A

  See Also:
    Constant Field Values

### KEY_B

    public static final int KEY_B

  Key code for B

  See Also:
    Constant Field Values

### KEY_C

    public static final int KEY_C

  Key code for C

  See Also:
    Constant Field Values

### KEY_D

    public static final int KEY_D

  Key code for D

  See Also:
    Constant Field Values

### KEY_E

    public static final int KEY_E

  Key code for E

  See Also:
    Constant Field Values

### KEY_F

    public static final int KEY_F

  Key code for F

  See Also:
    Constant Field Values

### KEY_G

    public static final int KEY_G

  Key code for G

  See Also:
    Constant Field Values

### KEY_H

    public static final int KEY_H

  Key code for H

  See Also:
    Constant Field Values

### KEY_I

    public static final int KEY_I

  Key code for I

  See Also:
    Constant Field Values

### KEY_J

    public static final int KEY_J

  Key code for J

  See Also:
    Constant Field Values

### KEY_K

    public static final int KEY_K

  Key code for K

  See Also:
    Constant Field Values

### KEY_L

    public static final int KEY_L

  Key code for L

  See Also:
    Constant Field Values

### KEY_M

    public static final int KEY_M

  Key code for M

  See Also:
    Constant Field Values

### KEY_N

    public static final int KEY_N

  Key code for N

  See Also:
    Constant Field Values

### KEY_O

    public static final int KEY_O

  Key code for O

  See Also:
    Constant Field Values

### KEY_P

    public static final int KEY_P

  Key code for P

  See Also:
    Constant Field Values

### KEY_Q

    public static final int KEY_Q

  Key code for Q

  See Also:
    Constant Field Values

### KEY_R

    public static final int KEY_R

  Key code for R

  See Also:
    Constant Field Values

### KEY_S

    public static final int KEY_S

  Key code for S

  See Also:
    Constant Field Values

### KEY_T

    public static final int KEY_T

  Key code for T

  See Also:
    Constant Field Values

### KEY_U

    public static final int KEY_U

  Key code for U

  See Also:
    Constant Field Values

### KEY_V

    public static final int KEY_V

  Key code for V

  See Also:
    Constant Field Values

### KEY_W

    public static final int KEY_W

  Key code for W

  See Also:
    Constant Field Values

### KEY_X

    public static final int KEY_X

  Key code for X

  See Also:
    Constant Field Values

### KEY_Y

    public static final int KEY_Y

  Key code for Y

  See Also:
    Constant Field Values

### KEY_Z

    public static final int KEY_Z

  Key code for Z

  See Also:
    Constant Field Values

### KEY_ZERO

    public static final int KEY_ZERO

  Key code number 0

  See Also:
    Constant Field Values

### KEY_ONE

    public static final int KEY_ONE

  Key code number 1

  See Also:
    Constant Field Values

### KEY_TWO

    public static final int KEY_TWO

  Key code number 2

  See Also:
    Constant Field Values

### KEY_THREE

    public static final int KEY_THREE

  Key code number 3

  See Also:
    Constant Field Values

### KEY_FOUR

    public static final int KEY_FOUR

  Key code number 4

  See Also:
    Constant Field Values

### KEY_FIVE

    public static final int KEY_FIVE

  Key code number 5

  See Also:
    Constant Field Values

### KEY_SIX

    public static final int KEY_SIX

  Key code number 6

  See Also:
    Constant Field Values

### KEY_SEVEN

    public static final int KEY_SEVEN

  Key code number 7

  See Also:
    Constant Field Values

### KEY_EIGHT

    public static final int KEY_EIGHT

  Key code number 8

  See Also:
    Constant Field Values

### KEY_NINE

    public static final int KEY_NINE

  Key code number 9

  See Also:
    Constant Field Values

### KEY_NUM_ZERO

    public static final int KEY_NUM_ZERO

  Key code for number 0 on numeric keyboard

  See Also:
    Constant Field Values

### KEY_NUM_ONE

    public static final int KEY_NUM_ONE

  Key code for number 1 on numeric keyboard

  See Also:
    Constant Field Values

### KEY_NUM_TWO

    public static final int KEY_NUM_TWO

  Key code for number 2 on numeric keyboard

  See Also:
    Constant Field Values

### KEY_NUM_THREE

    public static final int KEY_NUM_THREE

  Key code for number 3 on numeric keyboard

  See Also:
    Constant Field Values

### KEY_NUM_FOUR

    public static final int KEY_NUM_FOUR

  Key code for number 4 on numeric keyboard

  See Also:
    Constant Field Values

### KEY_NUM_FIVE

    public static final int KEY_NUM_FIVE

  Key code for number 5 on numeric keyboard

  See Also:
    Constant Field Values

### KEY_NUM_SIX

    public static final int KEY_NUM_SIX

  Key code for number 6 on numeric keyboard

  See Also:
    Constant Field Values

### KEY_NUM_SEVEN

    public static final int KEY_NUM_SEVEN

  Key code for number 7 on numeric keyboard

  See Also:
    Constant Field Values

### KEY_NUM_EIGHT

    public static final int KEY_NUM_EIGHT

  Key code for number 8 on numeric keyboard

  See Also:
    Constant Field Values

### KEY_NUM_NINE

    public static final int KEY_NUM_NINE

  Key code for number 9 on numeric keyboard

  See Also:
    Constant Field Values

### KEY_NUM_MULTIPLY

    public static final int KEY_NUM_MULTIPLY

  Key code for multiply on numeric keyboard

  See Also:
    Constant Field Values

### KEY_NUM_PLUS

    public static final int KEY_NUM_PLUS

  Key code for plus on numeric keyboard

  See Also:
    Constant Field Values

### KEY_NUM_MINUS

    public static final int KEY_NUM_MINUS

  Key code for minus on numeric keyboard

  See Also:
    Constant Field Values

### KEY_NUM_PERIOD

    public static final int KEY_NUM_PERIOD

  Key code for period on numeric keyboard

  See Also:
    Constant Field Values

### KEY_NUM_DIVISION

    public static final int KEY_NUM_DIVISION

  Key code for division on numeric keyboard

  See Also:
    Constant Field Values

### KEY_ALT

    public static final int KEY_ALT

  Alt key code.

  See Also:
    Constant Field Values

### KEY_BACKSPACE

    public static final int KEY_BACKSPACE

  Backspace key code.

  See Also:
    Constant Field Values

### KEY_CTRL

    public static final int KEY_CTRL

  Control key code.

  See Also:
    Constant Field Values

### KEY_DELETE

    public static final int KEY_DELETE

  Delete key code (also numeric keypad delete).

  See Also:
    Constant Field Values

### KEY_DOWN

    public static final int KEY_DOWN

  Down arrow code (Also numeric keypad down).

  See Also:
    Constant Field Values

### KEY_END

    public static final int KEY_END

  End key code (Also numeric keypad south west).

  See Also:
    Constant Field Values

### KEY_ENTER

    public static final int KEY_ENTER

  Enter key code.

  See Also:
    Constant Field Values

### KEY_ESCAPE

    public static final int KEY_ESCAPE

  Escape key code.

  See Also:
    Constant Field Values

### KEY_HOME

    public static final int KEY_HOME

  Home key code (Also numeric keypad north west).

  See Also:
    Constant Field Values

### KEY_LEFT

    public static final int KEY_LEFT

  Left key code (Also numeric keypad west).

  See Also:
    Constant Field Values

### KEY_PAGEDOWN

    public static final int KEY_PAGEDOWN

  Page down key code (Also numeric keypad south east).

  See Also:
    Constant Field Values

### KEY_PAGEUP

    public static final int KEY_PAGEUP

  Page up key code (Also numeric keypad north east).

  See Also:
    Constant Field Values

### KEY_RIGHT

    public static final int KEY_RIGHT

  Right arrow key code (Also numeric keypad east).

  See Also:
    Constant Field Values

### KEY_SHIFT

    public static final int KEY_SHIFT

  Shift key code.

  See Also:
    Constant Field Values

### KEY_TAB

    public static final int KEY_TAB

  Tab key code.

  See Also:
    Constant Field Values

### KEY_UP

    public static final int KEY_UP

  Up Arrow key code (Also numeric keypad north).

  See Also:
    Constant Field Values

### KEY_F1

    public static final int KEY_F1

  Key code for F1

  See Also:
    Constant Field Values

### KEY_F2

    public static final int KEY_F2

  Key code for F2

  See Also:
    Constant Field Values

### KEY_F3

    public static final int KEY_F3

  Key code for F3

  See Also:
    Constant Field Values

### KEY_F4

    public static final int KEY_F4

  Key code for F4

  See Also:
    Constant Field Values

### KEY_F5

    public static final int KEY_F5

  Key code for F5

  See Also:
    Constant Field Values

### KEY_F6

    public static final int KEY_F6

  Key code for F6

  See Also:
    Constant Field Values

### KEY_F7

    public static final int KEY_F7

  Key code for F7

  See Also:
    Constant Field Values

### KEY_F8

    public static final int KEY_F8

  Key code for F8

  See Also:
    Constant Field Values

### KEY_F9

    public static final int KEY_F9

  Key code for F9

  See Also:
    Constant Field Values

### KEY_F10

    public static final int KEY_F10

  Key code for F10

  See Also:
    Constant Field Values

### KEY_F11

    public static final int KEY_F11

  Key code for F11

  See Also:
    Constant Field Values

### KEY_F12

    public static final int KEY_F12

  Key code for F12

  See Also:
    Constant Field Values

### KEY_WIN_KEY_FF_LINUX

    public static final int KEY_WIN_KEY_FF_LINUX

  Key code for Windows key on Firefox Linux

  See Also:
    Constant Field Values

### KEY_MAC_ENTER

    public static final int KEY_MAC_ENTER

  Key code for Mac enter key

  See Also:
    Constant Field Values

### KEY_PAUSE

    public static final int KEY_PAUSE

  Key code for pause key

  See Also:
    Constant Field Values

### KEY_CAPS_LOCK

    public static final int KEY_CAPS_LOCK

  Key code for caps lock key

  See Also:
    Constant Field Values

### KEY_SPACE

    public static final int KEY_SPACE

  Key code for space

  See Also:
    Constant Field Values

### KEY_PRINT_SCREEN

    public static final int KEY_PRINT_SCREEN

  Key code for print key

  See Also:
    Constant Field Values

### KEY_INSERT

    public static final int KEY_INSERT

  Key code for insert key (Also numeric keyboard insert).

  See Also:
    Constant Field Values

### KEY_NUM_CENTER

    public static final int KEY_NUM_CENTER

  Key code for insert key (Also num lock on FF,Safari Mac).

  See Also:
    Constant Field Values

### KEY_WIN_KEY

    public static final int KEY_WIN_KEY

  Key code for left windows key.

  See Also:
    Constant Field Values

### KEY_WIN_KEY_LEFT_META

    public static final int KEY_WIN_KEY_LEFT_META

  Key code for left windows key or meta.

  See Also:
    Constant Field Values

### KEY_WIN_KEY_RIGHT

    public static final int KEY_WIN_KEY_RIGHT

  Key code for right windows key.

  See Also:
    Constant Field Values

### KEY_CONTEXT_MENU

    public static final int KEY_CONTEXT_MENU

  Key code for context menu key.

  See Also:
    Constant Field Values

### KEY_MAC_FF_META

    public static final int KEY_MAC_FF_META

  Key code for `KEY_WIN_KEY_LEFT_META` that Firefox fires for the meta key.

  See Also:
    Constant Field Values

### KEY_NUMLOCK

    public static final int KEY_NUMLOCK

  Key code for num lock.

  See Also:
    Constant Field Values

### KEY_SCROLL_LOCK

    public static final int KEY_SCROLL_LOCK

  Key code for scroll lock.

  See Also:
    Constant Field Values

### KEY_FIRST_MEDIA_KEY

    public static final int KEY_FIRST_MEDIA_KEY

  Key code for first OS specific media key (like volume).

  See Also:
    Constant Field Values

### KEY_LAST_MEDIA_KEY

    public static final int KEY_LAST_MEDIA_KEY

  Key code for last OS specific media key (like volume).

  See Also:
    Constant Field Values

### KEY_WIN_IME

    public static final int KEY_WIN_IME

  Key code for IME.

  See Also:
    Constant Field Values

Method Detail

### isArrowKey

    public static boolean isArrowKey(int code)

  Determines if a key code is an arrow key.

### maybeSwapArrowKeysForRtl

    public static int maybeSwapArrowKeysForRtl(int code,
                                               boolean isRtl)

  Update arrow keys for left and right based on current locale.

  Note: this method is used internally by built-in GWT widgets but could be renamed/refactored without notice.

  This method simplifies RTL handling in your code: ``

       int keyCode = KeyCodes.maybeSwapArrowKeysForRtl(event.getKeyCode(),
         LocaleInfo.getCurrentLocale().isRTL());
       switch (keyCode) {
         case KeyCodes.KEY_LEFT:
           ... // start of the line, no special RTL handling
           break;
         case KeyCodes.KEY_RIGHT:
           ... // end of the line, no special RTL handling
           break;
         ...
         }

Overview | Package | Class | Use | Deprecated | Help
| GWT 2.7.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD