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

All Superinterfaces:
  java.util.EventListener

All Known Implementing Classes:
  DelegatingKeyboardListenerCollection, KeyboardListenerAdapter

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

    public static final int KEY_ALT

See Also:
  Constant Field Values

### KEY_BACKSPACE

    public static final int KEY_BACKSPACE

See Also:
  Constant Field Values

### KEY_CTRL

    public static final int KEY_CTRL

See Also:
  Constant Field Values

### KEY_DELETE

    public static final int KEY_DELETE

See Also:
  Constant Field Values

### KEY_DOWN

    public static final int KEY_DOWN

See Also:
  Constant Field Values

### KEY_END

    public static final int KEY_END

See Also:
  Constant Field Values

### KEY_ENTER

    public static final int KEY_ENTER

See Also:
  Constant Field Values

### KEY_ESCAPE

    public static final int KEY_ESCAPE

See Also:
  Constant Field Values

### KEY_HOME

    public static final int KEY_HOME

See Also:
  Constant Field Values

### KEY_LEFT

    public static final int KEY_LEFT

See Also:
  Constant Field Values

### KEY_PAGEDOWN

    public static final int KEY_PAGEDOWN

See Also:
  Constant Field Values

### KEY_PAGEUP

    public static final int KEY_PAGEUP

See Also:
  Constant Field Values

### KEY_RIGHT

    public static final int KEY_RIGHT

See Also:
  Constant Field Values

### KEY_SHIFT

    public static final int KEY_SHIFT

See Also:
  Constant Field Values

### KEY_TAB

    public static final int KEY_TAB

See Also:
  Constant Field Values

### KEY_UP

    public static final int KEY_UP

See Also:
  Constant Field Values

### MODIFIER_ALT

    public static final int MODIFIER_ALT

See Also:
  Constant Field Values

### MODIFIER_CTRL

    public static final int MODIFIER_CTRL

See Also:
  Constant Field Values

### MODIFIER_META

    public static final int MODIFIER_META

See Also:
  Constant Field Values

### MODIFIER_SHIFT

    public static final int MODIFIER_SHIFT

See Also:
  Constant Field Values

Method Detail

### onKeyDown

    public 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

    public 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

    public 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`.