KeyEventNameKeyEvent
DescriptionKey events are generated when the user types on the keyboard. Class Definition
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); } ConstantsCHAR_UNDEFINEDpublic final static int CHAR_UNDEFINEDThis constant is used for key presses have that no associated character. KEY_FIRSTpublic final static int KEY_FIRSTSpecifies the beginning range of key event ID values. KEY_LASTpublic final static int KEY_LASTSpecifies the ending range of key event ID values. KEY_PRESSEDpublic final static int KEY_PRESSEDAn event ID type for a key press. KEY_RELEASEDpublic final static int KEY_RELEASEDAn event ID type for a key release. KEY_TYPEDpublic final static int KEY_TYPEDAn event ID type for a typed key (a press and a release). VK_0public final static int VK_0The 0 key. VK_1public final static int VK_1The 1 key. VK_2public final static int VK_2The 2 key. VK_3public final static int VK_3The 3 key. VK_4public final static int VK_4The 4 key. VK_5public final static int VK_5The 5 key. VK_6public final static int VK_6The 6 key. VK_7public final static int VK_7The 7 key. VK_8public final static int VK_8The 8 key. VK_9public final static int VK_9The 9 key. VK_Apublic final static int VK_AThe `a' key. VK_ACCEPTpublic final static int VK_ACCEPTThis constant is used for Asian keyboards. VK_ADDpublic final static int VK_ADDThe plus (+) key on the numeric keypad. VK_ALTpublic final static int VK_ALTThe Alt key. VK_Bpublic final static int VK_BThe `b' key. VK_BACK_QUOTEpublic final static int VK_BACK_QUOTEThe backquote (`) key. VK_BACK_SLASHpublic final static int VK_BACK_SLASHThe backslash key. VK_BACK_SPACEpublic final static int VK_BACK_SPACEThe Backspace key. VK_Cpublic final static int VK_CThe `c' key. VK_CANCELpublic final static int VK_CANCELThe Cancel key. VK_CAPS_LOCKpublic final static int VK_CAPS_LOCKThe Caps Lock key. VK_CLEARpublic final static int VK_CLEARThe Clear key. VK_CLOSE_BRACKETpublic final static int VK_CLOSE_BRACKETThe close bracket `]' key. VK_COMMApublic final static int VK_COMMAThe comma (,) key. VK_CONTROLpublic final static int VK_CONTROLThe Control key. VK_CONVERTpublic final static int VK_CONVERTThis constant is used for Asian keyboards. VK_Dpublic final static int VK_DThe `d' key. VK_DECIMALpublic final static int VK_DECIMALThe decimal (.) key on the numeric keypad. VK_DELETEpublic final static int VK_DELETEThe Delete key. VK_DIVIDEpublic final static int VK_DIVIDEThe divide (/) key on the numeric keypad. VK_DOWNpublic final static int VK_DOWNThe Down arrow key. VK_Epublic final static int VK_EThe `e' key. VK_ENDpublic final static int VK_ENDThe End key. VK_ENTERpublic final static int VK_ENTERThe Enter key. VK_EQUALSpublic final static int VK_ EQUALSThe equals (=) key. VK_ESCAPEpublic final static int VK_ESCAPEThe Escape key. VK_Fpublic final static int VK_FThe `f' key. VK_F1public final static int VK_F1The F1 key. VK_F2public final static int VK_F2The F2 key. VK_F3public final static int VK_F3The F3 key. VK_F4public final static int VK_F4The F4 key. VK_F5public final static int VK_F5The F5 key. VK_F6public final static int VK_F6The F6 key. VK_F7public final static int VK_F7The F7 key. VK_F8public final static int VK_F8The F8 key. VK_F9public final static int VK_F9The F9 key. VK_F10public final static int VK_F10The F10 key. VK_F11public final static int VK_F11The F11 key. VK_F12public final static int VK_F12The F12 key. VK_FINALpublic final static int VK_FINALThis constant is used for Asian keyboards. VK_Gpublic final static int VK_GThe `g' key. VK_Hpublic final static int VK_HThe `h' key. VK_HELPpublic final static int VK_HELPThe Help key. VK_HOMEpublic final static int VK_HOMEThe Home key. VK_Ipublic final static int VK_IThe `i' key. VK_INSERTpublic final static int VK_INSERTThe Insert key. VK_Jpublic final static int VK_JThe `j' key. VK_Kpublic final static int VK_KThe `k' key. VK_KANApublic final static int VK_KANAThis constant is used for Asian keyboards. VK_KANJIpublic final static int VK_KANJIThis constant is used for Asian keyboards. VK_Lpublic final static int VK_LThe `l' key. VK_LEFTpublic final static int VK_LEFTThe Left arrow key. VK_Mpublic final static int VK_MThe `m' key. VK_MODECHANGEpublic final static int VK_MODECHANGEThis constant is used for Asian keyboards. VK_METApublic final static int VK_METAThe Meta key. VK_MULTIPLYpublic final static int VK_MULTIPLYThe * key on the numeric keypad. VK_Npublic final static int VK_NThe `n' key. VK_NONCONVERTpublic final static int VK_NONCONVERTThis constant is used for Asian keyboards. VK_NUM_LOCKpublic final static int VK_NUM_LOCKThe Num Lock key. VK_NUMPAD0public final static int VK_NUMPAD0The 0 key on the numeric keypad. VK_NUMPAD1public final static int VK_NUMPAD1The 1 key on the numeric keypad. VK_NUMPAD2public final static int VK_NUMPAD2The 2 key on the numeric keypad. VK_NUMPAD3public final static int VK_NUMPAD3The 3 key on the numeric keypad. VK_NUMPAD4public final static int VK_NUMPAD4The 4 key on the numeric keypad. VK_NUMPAD5public final static int VK_NUMPAD5The 5 key on the numeric keypad. VK_NUMPAD6public final static int VK_NUMPAD6The 6 key on the numeric keypad. VK_NUMPAD7public final static int VK_NUMPAD7The 7 key on the numeric keypad. VK_NUMPAD8public final static int VK_NUMPAD8The 8 key on the numeric keypad. VK_NUMPAD9public final static int VK_NUMPAD9The 9 key on the numeric keypad. VK_Opublic final static int VK_OThe `o' key. VK_OPEN_BRACKETpublic final static int VK_OPEN_BRACKETThe open bracket `[` key. VK_Ppublic final static int VK_PThe `p' key. VK_PAGE_DOWNpublic final static int VK_PAGE_DOWNThe Page Down key. VK_PAGE_UPpublic final static int VK_PAGE_UPThe Page Up key. VK_PAUSEpublic final static int VK_PAUSEThe Pause key. VK_PERIODpublic final static int VK_PERIODThe period (.) key. VK_PRINTSCREENpublic final static int VK_PRINTSCREENThe Print Screen key. VK_Qpublic final static int VK_QThe `q' key. VK_QUOTEpublic final static int VK_QUOTEThe quotation mark (") key. VK_Rpublic final static int VK_RThe `r' key. VK_RIGHTpublic final static int VK_RIGHTThe Right arrow key. VK_Spublic final static int VK_SThe `s' key. VK_SCROLL_LOCKpublic final static int VK_SCROLL_LOCKThe Scroll Lock key. VK_SEMICOLONpublic final static int VK_SEMICOLONThe semicolon (;) key. VK_SEPARATERpublic final static int VK_SEPARATERThe numeric separator key on the numeric keypad (i.e., the locale-dependent key used to separate groups of digits). A misspelling of VK_SEPARATOR. VK_SHIFTpublic final static int VK_SHIFTThe Shift key. VK_SLASHpublic final static int VK_SLASHThe slash (/) key. VK_SPACEpublic final static int VK_SPACEThe space key. VK_SUBTRACTpublic final static int VK_SUBTRACTThe subtract (-) key on the numeric keypad. VK_Tpublic final static int VK_TThe `t' key. VK_TABpublic final static int VK_TABThe Tab key. VK_Upublic final static int VK_UThe `u' key. VK_UNDEFINEDpublic final static int VK_UNDEFINEDAn undefined key. VK_UPpublic final static int VK_UPThe Up arrow key. VK_Vpublic final static int VK_VThe `v' key. VK_Wpublic final static int VK_WThe `w' key. VK_Xpublic final static int VK_XThe `x' key. VK_Ypublic final static int VK_YThe `y' key. VK_Zpublic final static int VK_ZThe `z' key. ConstructorsKeyEventpublic KeyEvent (Component source, int id, long when, int modifiers, int keyCode, char keyChar)
Class MethodsgetKeyModifiersTextpublic static String getKeyModifiersText(int modifiers)
getKeyTextpublic static String getKeyText(int keyCode)
Instance MethodsgetKeyCharpublic char getKeyChar()
getKeyCodepublic int getKeyCode()
isActionKeypublic boolean isActionKey()
paramStringpublic String paramString()
setKeyCharpublic void setKeyChar(char keyChar)
setKeyCodepublic void setKeyCode (int keyCode)
setModifierspublic void setModifiers (int modifiers)
See AlsoComponent, ComponentEvent, InputEvent, KeyAdapter, KeyListener |
|