KeyEvent

Name

public class java.awt.event.KeyEvent
extends java.awt.event.InputEvent {
// Constants
public final static int CHAR_UNDEFINED;
public final static int KEY_FIRST;
public final static int KEY_LAST;
public final static int KEY_PRESSED;
public final static int KEY_RELEASED;
public final static int KEY_TYPED;
public final static int VK_0;
public final static int VK_1;
public final static int VK_2;
public final static int VK_3;
public final static int VK_4;
public final static int VK_5;
public final static int VK_6;
public final static int VK_7;
public final static int VK_8;
public final static int VK_9;
public final static int VK_A;
public final static int VK_ACCEPT;
public final static int VK_ADD;
public final static int VK_ALT;
public final static int VK_B;
public final static int VK_BACK_QUOTE;
public final static int VK_BACK_SLASH;
public final static int VK_BACK_SPACE;
public final static int VK_C;
public final static int VK_CANCEL;
public final static int VK_CAPS_LOCK;
public final static int VK_CLEAR;
public final static int VK_CLOSE_BRACKET;
public final static int VK_COMMA;
public final static int VK_CONTROL;
public final static int VK_CONVERT;
public final static int VK_D;
public final static int VK_DECIMAL;
public final static int VK_DELETE;
public final static int VK_DIVIDE;
public final static int VK_DOWN;
public final static int VK_E;
public final static int VK_END;
public final static int VK_ENTER;
public final static int VK_EQUALS;
public final static int VK_ESCAPE;
public final static int VK_F;
public final static int VK_F1;
public final static int VK_F2;
public final static int VK_F3;
public final static int VK_F4;
public final static int VK_F5;
public final static int VK_F6;
public final static int VK_F7;
public final static int VK_F8;
public final static int VK_F9;
public final static int VK_F10;
public final static int VK_F11;
public final static int VK_F12;
public final static int VK_FINAL;
public final static int VK_G;
public final static int VK_H;
public final static int VK_HELP;
public final static int VK_HOME;
public final static int VK_I;
public final static int VK_INSERT;
public final static int VK_J;
public final static int VK_K;
public final static int VK_KANA;
public final static int VK_KANJI;
public final static int VK_L;
public final static int VK_LEFT;
public final static int VK_M;
public final static int VK_META;
public final static int VK_MODECHANGE;
public final static int VK_MULTIPLY;
public final static int VK_N;
public final static int VK_NONCONVERT;
public final static int VK_NUM_LOCK;
public final static int VK_NUMPAD0;
public final static int VK_NUMPAD1;
public final static int VK_NUMPAD2;
public final static int VK_NUMPAD3;
public final static int VK_NUMPAD4;
public final static int VK_NUMPAD5;
public final static int VK_NUMPAD6;
public final static int VK_NUMPAD7;
public final static int VK_NUMPAD8;
public final static int VK_NUMPAD9;
public final static int VK_O;
public final static int VK_OPEN_BRACKET;
public final static int VK_P;
public final static int VK_PAGE_DOWN;
public final static int VK_PAGE_UP;
public final static int VK_PAUSE;
public final static int VK_PERIOD;
public final static int VK_PRINTSCREEN;
public final static int VK_Q;
public final static int VK_QUOTE;
public final static int VK_R;
public final static int VK_RIGHT;
public final static int VK_S;
public final static int VK_SCROLL_LOCK;
public final static int VK_SEMICOLON;
public final static int VK_SEPARATER;
public final static int VK_SHIFT;
public final static int VK_SLASH;
public final static int VK_SPACE;
public final static int VK_SUBTRACT;
public final static int VK_T;
public final static int VK_TAB;
public final static int VK_U;
public final static int VK_UNDEFINED;
public final static int VK_UP;
public final static int VK_V;
public final static int VK_W;
public final static int VK_X;
public final static int VK_Y;
public final static int VK_Z;
// Constructors
public KeyEvent (Component source, int id, long when, int modifiers,
int keyCode, char keyChar);
// Class Methods
public static String getKeyModifiersText(int modifiers);
public static String getKeyText(int keyCode);
// Instance Methods
public char getKeyChar();
public int getKeyCode();
public boolean isActionKey();
public String paramString();
public void setKeyChar (char keyChar);
public void setKeyCode (int keyCode);
public void setModifiers (int modifiers);
}

The integer key code corresponding to this event. This will be one of the
constants defined above. KEY_PRESSED and KEY_RELEASED
events have codes. Key codes are virtual keys, not actual. Pressing the
`a' key is identical to `A', but has different
modifiers. Same for `/' and `?' on a standard
keyboard.

In general, an action key is a key that causes an action but has no printing
equivalent. The action keys are the function keys, the arrow keys, Caps
Lock, End, Home, Insert, Num Lock, Pause, Page Down, Page Up, Print Screen,
and Scroll Lock. They do not generate a KEY_TYPED event,
only KEY_PRESSED and KEY_RELEASED.