## com.google.gwt.user.client.ui
Interface KeyboardListener

All Superinterfaces:
  java.util.EventListener

All Known Implementing Classes:
  DecoratedTabBar, DelegatingKeyboardListenerCollection, KeyboardListenerAdapter, TabBar

    public interface KeyboardListener

extends java.util.EventListener

Event listener interface for keyboard events.

Field Summary
`static int` `KEY_ALT`
`static int` `KEY_BACKSPACE`
`static int` `KEY_CTRL`
`static int` `KEY_DELETE`
`static int` `KEY_DOWN`
`static int` `KEY_END`
`static int` `KEY_ENTER`
`static int` `KEY_ESCAPE`
`static int` `KEY_HOME`
`static int` `KEY_LEFT`
`static int` `KEY_PAGEDOWN`
`static int` `KEY_PAGEUP`
`static int` `KEY_RIGHT`
`static int` `KEY_SHIFT`
`static int` `KEY_TAB`
`static int` `KEY_UP`
`static int` `MODIFIER_ALT`
`static int` `MODIFIER_CTRL`
`static int` `MODIFIER_META`
`static int` `MODIFIER_SHIFT`

Method Summary
`void` `onKeyDown(Widget sender, char keyCode, int modifiers)` Fired when the user depresses a physical key.
`void` `onKeyPress(Widget sender, char keyCode, int modifiers)` Fired when a keyboard action generates a character.
`void` `onKeyUp(Widget sender, char keyCode, int modifiers)` Fired when the user releases a physical key.

Field Detail

### KEY_ALT

    static final int KEY_ALT

See Also:
  Constant Field Values

### KEY_BACKSPACE

    static final int KEY_BACKSPACE

See Also:
  Constant Field Values

### KEY_CTRL

    static final int KEY_CTRL

See Also:
  Constant Field Values

### KEY_DELETE

    static final int KEY_DELETE

See Also:
  Constant Field Values

### KEY_DOWN

    static final int KEY_DOWN

See Also:
  Constant Field Values

### KEY_END

    static final int KEY_END

See Also:
  Constant Field Values

### KEY_ENTER

    static final int KEY_ENTER

See Also:
  Constant Field Values

### KEY_ESCAPE

    static final int KEY_ESCAPE

See Also:
  Constant Field Values

### KEY_HOME

    static final int KEY_HOME

See Also:
  Constant Field Values

### KEY_LEFT

    static final int KEY_LEFT

See Also:
  Constant Field Values

### KEY_PAGEDOWN

    static final int KEY_PAGEDOWN

See Also:
  Constant Field Values

### KEY_PAGEUP

    static final int KEY_PAGEUP

See Also:
  Constant Field Values

### KEY_RIGHT

    static final int KEY_RIGHT

See Also:
  Constant Field Values

### KEY_SHIFT

    static final int KEY_SHIFT

See Also:
  Constant Field Values

### KEY_TAB

    static final int KEY_TAB

See Also:
  Constant Field Values

### KEY_UP

    static final int KEY_UP

See Also:
  Constant Field Values

### MODIFIER_ALT

    static final int MODIFIER_ALT

See Also:
  Constant Field Values

### MODIFIER_CTRL

    static final int MODIFIER_CTRL

See Also:
  Constant Field Values

### MODIFIER_META

    static final int MODIFIER_META

See Also:
  Constant Field Values

### MODIFIER_SHIFT

    static final int MODIFIER_SHIFT

See Also:
  Constant Field Values

Method Detail

### onKeyDown

    void onKeyDown(Widget sender,
                   char keyCode,
                   int modifiers)

  Fired when the user depresses a physical key.

  Parameters:
    `sender` - the widget that was focused when the event occurred.
    `keyCode` - the physical key that was depressed. Constants for this value are defined in this interface with the KEY prefix.
    `modifiers` - the modifier keys pressed at when the event occurred. This value is a combination of the bits defined by `MODIFIER_SHIFT`, `MODIFIER_CTRL`, and `MODIFIER_ALT`.

### onKeyPress

    void onKeyPress(Widget sender,
                    char keyCode,
                    int modifiers)

  Fired when a keyboard action generates a character. This occurs after onKeyDown and onKeyUp are fired for the physical key that was pressed.

  It should be noted that many browsers do not generate keypress events for non-printing keyCode values, such as `KEY_ENTER` or arrow keys. These keyCodes can be reliably captured either with `onKeyDown(Widget, char, int)` or `onKeyUp(Widget, char, int)`.

  Parameters:
    `sender` - the widget that was focused when the event occurred.
    `keyCode` - the Unicode character that was generated by the keyboard action.
    `modifiers` - the modifier keys pressed at when the event occurred. This value is a combination of the bits defined by `MODIFIER_SHIFT`, `MODIFIER_CTRL`, and `MODIFIER_ALT`.

### onKeyUp

    void onKeyUp(Widget sender,
                 char keyCode,
                 int modifiers)

  Fired when the user releases a physical key.

  Parameters:
    `sender` - the widget that was focused when the event occurred.
    `keyCode` - the physical key that was released. Constants for this value are defined in this interface with the KEY prefix.
    `modifiers` - the modifier keys pressed at when the event occurred. This value is a combination of the bits defined by `MODIFIER_SHIFT`, `MODIFIER_CTRL`, and `MODIFIER_ALT`.