Class MenuKeyEvent
java.lang.Object
java.util.EventObject
java.awt.AWTEvent
java.awt.event.ComponentEvent
java.awt.event.InputEvent
java.awt.event.KeyEvent
javax.swing.event.MenuKeyEvent
- All Implemented Interfaces:
Serializable
MenuKeyEvent is used to notify interested parties that
the menu element has received a KeyEvent forwarded to it
in a menu tree.
Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing. As of 1.4, support for long term storage
of all JavaBeans
has been added to the java.beans package.
Please see XMLEncoder.
-
Field Summary
Fields declared in class KeyEvent
CHAR_UNDEFINED, KEY_FIRST, KEY_LAST, KEY_LOCATION_LEFT, KEY_LOCATION_NUMPAD, KEY_LOCATION_RIGHT, KEY_LOCATION_STANDARD, KEY_LOCATION_UNKNOWN, KEY_PRESSED, KEY_RELEASED, KEY_TYPED, VK_0, VK_1, VK_2, VK_3, VK_4, VK_5, VK_6, VK_7, VK_8, VK_9, VK_A, VK_ACCEPT, VK_ADD, VK_AGAIN, VK_ALL_CANDIDATES, VK_ALPHANUMERIC, VK_ALT, VK_ALT_GRAPH, VK_AMPERSAND, VK_ASTERISK, VK_AT, VK_B, VK_BACK_QUOTE, VK_BACK_SLASH, VK_BACK_SPACE, VK_BEGIN, VK_BRACELEFT, VK_BRACERIGHT, VK_C, VK_CANCEL, VK_CAPS_LOCK, VK_CIRCUMFLEX, VK_CLEAR, VK_CLOSE_BRACKET, VK_CODE_INPUT, VK_COLON, VK_COMMA, VK_COMPOSE, VK_CONTEXT_MENU, VK_CONTROL, VK_CONVERT, VK_COPY, VK_CUT, VK_D, VK_DEAD_ABOVEDOT, VK_DEAD_ABOVERING, VK_DEAD_ACUTE, VK_DEAD_BREVE, VK_DEAD_CARON, VK_DEAD_CEDILLA, VK_DEAD_CIRCUMFLEX, VK_DEAD_DIAERESIS, VK_DEAD_DOUBLEACUTE, VK_DEAD_GRAVE, VK_DEAD_IOTA, VK_DEAD_MACRON, VK_DEAD_OGONEK, VK_DEAD_SEMIVOICED_SOUND, VK_DEAD_TILDE, VK_DEAD_VOICED_SOUND, VK_DECIMAL, VK_DELETE, VK_DIVIDE, VK_DOLLAR, VK_DOWN, VK_E, VK_END, VK_ENTER, VK_EQUALS, VK_ESCAPE, VK_EURO_SIGN, VK_EXCLAMATION_MARK, VK_F, VK_F1, VK_F10, VK_F11, VK_F12, VK_F13, VK_F14, VK_F15, VK_F16, VK_F17, VK_F18, VK_F19, VK_F2, VK_F20, VK_F21, VK_F22, VK_F23, VK_F24, VK_F3, VK_F4, VK_F5, VK_F6, VK_F7, VK_F8, VK_F9, VK_FINAL, VK_FIND, VK_FULL_WIDTH, VK_G, VK_GREATER, VK_H, VK_HALF_WIDTH, VK_HELP, VK_HIRAGANA, VK_HOME, VK_I, VK_INPUT_METHOD_ON_OFF, VK_INSERT, VK_INVERTED_EXCLAMATION_MARK, VK_J, VK_JAPANESE_HIRAGANA, VK_JAPANESE_KATAKANA, VK_JAPANESE_ROMAN, VK_K, VK_KANA, VK_KANA_LOCK, VK_KANJI, VK_KATAKANA, VK_KP_DOWN, VK_KP_LEFT, VK_KP_RIGHT, VK_KP_UP, VK_L, VK_LEFT, VK_LEFT_PARENTHESIS, VK_LESS, VK_M, VK_META, VK_MINUS, VK_MODECHANGE, VK_MULTIPLY, VK_N, VK_NONCONVERT, VK_NUM_LOCK, VK_NUMBER_SIGN, VK_NUMPAD0, VK_NUMPAD1, VK_NUMPAD2, VK_NUMPAD3, VK_NUMPAD4, VK_NUMPAD5, VK_NUMPAD6, VK_NUMPAD7, VK_NUMPAD8, VK_NUMPAD9, VK_O, VK_OPEN_BRACKET, VK_P, VK_PAGE_DOWN, VK_PAGE_UP, VK_PASTE, VK_PAUSE, VK_PERIOD, VK_PLUS, VK_PREVIOUS_CANDIDATE, VK_PRINTSCREEN, VK_PROPS, VK_Q, VK_QUOTE, VK_QUOTEDBL, VK_R, VK_RIGHT, VK_RIGHT_PARENTHESIS, VK_ROMAN_CHARACTERS, VK_S, VK_SCROLL_LOCK, VK_SEMICOLON, VK_SEPARATER, VK_SEPARATOR, VK_SHIFT, VK_SLASH, VK_SPACE, VK_STOP, VK_SUBTRACT, VK_T, VK_TAB, VK_U, VK_UNDEFINED, VK_UNDERSCORE, VK_UNDO, VK_UP, VK_V, VK_W, VK_WINDOWS, VK_X, VK_Y, VK_ZModifier and TypeFieldDescriptionstatic final charKEY_PRESSED and KEY_RELEASED events which do not map to a valid Unicode character use this for the keyChar value.static final intThe first number in the range of ids used for key events.static final intThe last number in the range of ids used for key events.static final intA constant indicating that the key pressed or released is in the left key location (there is more than one possible location for this key).static final intA constant indicating that the key event originated on the numeric keypad or with a virtual key corresponding to the numeric keypad.static final intA constant indicating that the key pressed or released is in the right key location (there is more than one possible location for this key).static final intA constant indicating that the key pressed or released is not distinguished as the left or right version of a key, and did not originate on the numeric keypad (or did not originate with a virtual key corresponding to the numeric keypad).static final intA constant indicating that the keyLocation is indeterminate or not relevant.static final intThe "key pressed" event.static final intThe "key released" event.static final intThe "key typed" event.static final intConstant for the "0" key.static final intConstant for the "1" key.static final intConstant for the "2" key.static final intConstant for the "3" key.static final intConstant for the "4" key.static final intConstant for the "5" key.static final intConstant for the "6" key.static final intConstant for the "7" key.static final intConstant for the "8" key.static final intConstant for the "9" key.static final intConstant for the "A" key.static final intConstant for the Accept or Commit function key.static final intConstant for the number pad add key.static final intConstant for the Again key.static final intConstant for the All Candidates function key.static final intConstant for the Alphanumeric function key.static final intConstant for the ALT virtual key.static final intConstant for the AltGraph function key.static final intConstant for the "&" key.static final intConstant for the "*" key.static final intConstant for the "@" key.static final intConstant for the "B" key.static final intConstant for the BACK_QUOTE key.static final intConstant for the back slash key, "\"static final intConstant for the BACK_SPACE virtual key.static final intConstant for the Begin key.static final intConstant for the "{" key.static final intConstant for the "}" key.static final intConstant for the "C" key.static final intConstant for the CANCEL virtual key.static final intConstant for the CAPS_LOCK virtual key.static final intConstant for the "^" key.static final intConstant for the CLEAR virtual key.static final intConstant for the close bracket key, "]"static final intConstant for the Code Input function key.static final intConstant for the ":" key.static final intConstant for the comma key, ","static final intConstant for the Compose function key.static final intConstant for the Microsoft Windows Context Menu key.static final intConstant for the CONTROL virtual key.static final intConstant for the Convert function key.static final intConstant for the Copy key.static final intConstant for the Cut key.static final intConstant for the "D" key.static final intConstant for the Dead Above Dot key.static final intConstant for the Dead Above Ring key.static final intConstant for the Dead Acute key.static final intConstant for the Dead Breve key.static final intConstant for the Dead Caron key.static final intConstant for the Dead Cedilla key.static final intConstant for the Dead Circumflex key.static final intConstant for the Dead Diaeresis key.static final intConstant for the Dead Double Acute key.static final intConstant for the Dead Grave key.static final intConstant for the Dead Iota key.static final intConstant for the Dead Macron key.static final intConstant for the Dead Ogonek key.static final intConstant for the Dead Semivoiced Sound key.static final intConstant for the Dead Tilde key.static final intConstant for the Dead Voiced Sound key.static final intConstant for the number pad decimal point key.static final intConstant for the delete key.static final intConstant for the number pad divide key.static final intConstant for the "$" key.static final intConstant for the non-numpad down arrow key.static final intConstant for the "E" key.static final intConstant for the END virtual key.static final intConstant for the ENTER virtual key.static final intConstant for the equals key, "="static final intConstant for the ESCAPE virtual key.static final intConstant for the Euro currency sign key.static final intConstant for the "!"static final intConstant for the "F" key.static final intConstant for the F1 function key.static final intConstant for the F10 function key.static final intConstant for the F11 function key.static final intConstant for the F12 function key.static final intConstant for the F13 function key.static final intConstant for the F14 function key.static final intConstant for the F15 function key.static final intConstant for the F16 function key.static final intConstant for the F17 function key.static final intConstant for the F18 function key.static final intConstant for the F19 function key.static final intConstant for the F2 function key.static final intConstant for the F20 function key.static final intConstant for the F21 function key.static final intConstant for the F22 function key.static final intConstant for the F23 function key.static final intConstant for the F24 function key.static final intConstant for the F3 function key.static final intConstant for the F4 function key.static final intConstant for the F5 function key.static final intConstant for the F6 function key.static final intConstant for the F7 function key.static final intConstant for the F8 function key.static final intConstant for the F9 function key.static final intConstant for the FINAL key.static final intConstant for the Find key.static final intConstant for the Full-Width Characters function key.static final intConstant for the "G" key.static final intConstant for the ">" key.static final intConstant for the "H" key.static final intConstant for the Half-Width Characters function key.static final intConstant for the HELP key.static final intConstant for the Hiragana function key.static final intConstant for the HOME virtual key.static final intConstant for the "I" key.static final intConstant for the input method on/off key.static final intConstant for the INSERT key.static final intConstant for the inverted exclamation mark key.static final intConstant for the "J" key.static final intConstant for the Japanese-Hiragana function key.static final intConstant for the Japanese-Katakana function key.static final intConstant for the Japanese-Roman function key.static final intConstant for the "K" key.static final intConstant for the KANA lock key.static final intConstant for the locking Kana function key.static final intConstant for KANJI.static final intConstant for the Katakana function key.static final intConstant for the numeric keypad down arrow key.static final intConstant for the numeric keypad left arrow key.static final intConstant for the numeric keypad right arrow key.static final intConstant for the numeric keypad up arrow key.static final intConstant for the "L" key.static final intConstant for the non-numpad left arrow key.static final intConstant for the "(" key.static final intConstant for the "<" key.static final intConstant for the "M" key.static final intConstant for the META key.static final intConstant for the minus key, "-"static final intConstant for the MODECHANGE key.static final intConstant for the number pad multiply key.static final intConstant for the "N" key.static final intConstant for the Don't Convert function key.static final intConstant for the NUM_LOCK key.static final intConstant for the "#" key.static final intConstant for the number pad "0" key.static final intConstant for the number pad "1" key.static final intConstant for the number pad "2" key.static final intConstant for the number pad "3" key.static final intConstant for the number pad "4" key.static final intConstant for the number pad "5" key.static final intConstant for the number pad "6" key.static final intConstant for the number pad "7" key.static final intConstant for the number pad "8" key.static final intConstant for the number pad "9" key.static final intConstant for the "O" key.static final intConstant for the open bracket key, "["static final intConstant for the "P" key.static final intConstant for the PAGE_DOWN virtual key.static final intConstant for the PAGE_UP virtual key.static final intConstant for the Paste key.static final intConstant for the PAUSE virtual key.static final intConstant for the period key, "."static final intConstant for the "+" key.static final intConstant for the Previous Candidate function key.static final intConstant for the PRINTSCREEN key.static final intConstant for the Props key.static final intConstant for the "Q" key.static final intConstant for the QUOTE key.static final intConstant for the """" key.static final intConstant for the "R" key.static final intConstant for the non-numpad right arrow key.static final intConstant for the ")" key.static final intConstant for the Roman Characters function key.static final intConstant for the "S" key.static final intConstant for the SCROLL_LOCK key.static final intConstant for the semicolon key, ";"static final intThis constant is obsolete, and is included only for backwards compatibility.static final intConstant for the Numpad Separator key.static final intConstant for the SHIFT virtual key.static final intConstant for the forward slash key, "/"static final intConstant for the SPACE virtual key.static final intConstant for the Stop key.static final intConstant for the number pad subtract key.static final intConstant for the "T" key.static final intConstant for the TAB virtual key.static final intConstant for the "U" key.static final intThis value is used to indicate that the keyCode is unknown.static final intConstant for the "_" key.static final intConstant for the Undo key.static final intConstant for the non-numpad up arrow key.static final intConstant for the "V" key.static final intConstant for the "W" key.static final intConstant for the Microsoft Windows "Windows" key.static final intConstant for the "X" key.static final intConstant for the "Y" key.static final intConstant for the "Z" key.Fields declared in class InputEvent
ALT_DOWN_MASK, ALT_GRAPH_DOWN_MASK, ALT_GRAPH_MASK, ALT_MASK, BUTTON1_DOWN_MASK, BUTTON1_MASK, BUTTON2_DOWN_MASK, BUTTON2_MASK, BUTTON3_DOWN_MASK, BUTTON3_MASK, CTRL_DOWN_MASK, CTRL_MASK, META_DOWN_MASK, META_MASK, SHIFT_DOWN_MASK, SHIFT_MASKModifier and TypeFieldDescriptionstatic final intThe Alt key extended modifier constant.static final intThe AltGraph key extended modifier constant.static final intDeprecated.static final intDeprecated.It is recommended that ALT_DOWN_MASK andInputEvent.getModifiersEx()be used insteadstatic final intThe Mouse Button1 extended modifier constant.static final intDeprecated.It is recommended that BUTTON1_DOWN_MASK andInputEvent.getModifiersEx()be used insteadstatic final intThe Mouse Button2 extended modifier constant.static final intDeprecated.It is recommended that BUTTON2_DOWN_MASK andInputEvent.getModifiersEx()be used instead.static final intThe Mouse Button3 extended modifier constant.static final intDeprecated.It is recommended that BUTTON3_DOWN_MASK andInputEvent.getModifiersEx()be used instead.static final intThe Control key extended modifier constant.static final intDeprecated.It is recommended that CTRL_DOWN_MASK andInputEvent.getModifiersEx()be used insteadstatic final intThe Meta key extended modifier constant.static final intDeprecated.It is recommended that META_DOWN_MASK andInputEvent.getModifiersEx()be used insteadstatic final intThe Shift key extended modifier constant.static final intDeprecated.It is recommended that SHIFT_DOWN_MASK andInputEvent.getModifiersEx()be used insteadFields declared in class ComponentEvent
COMPONENT_FIRST, COMPONENT_HIDDEN, COMPONENT_LAST, COMPONENT_MOVED, COMPONENT_RESIZED, COMPONENT_SHOWNModifier and TypeFieldDescriptionstatic final intThe first number in the range of ids used for component events.static final intThis event indicates that the component was rendered invisible.static final intThe last number in the range of ids used for component events.static final intThis event indicates that the component's position changed.static final intThis event indicates that the component's size changed.static final intThis event indicates that the component was made visible.Fields declared in class AWTEvent
ACTION_EVENT_MASK, ADJUSTMENT_EVENT_MASK, COMPONENT_EVENT_MASK, consumed, CONTAINER_EVENT_MASK, FOCUS_EVENT_MASK, HIERARCHY_BOUNDS_EVENT_MASK, HIERARCHY_EVENT_MASK, id, INPUT_METHOD_EVENT_MASK, INVOCATION_EVENT_MASK, ITEM_EVENT_MASK, KEY_EVENT_MASK, MOUSE_EVENT_MASK, MOUSE_MOTION_EVENT_MASK, MOUSE_WHEEL_EVENT_MASK, PAINT_EVENT_MASK, RESERVED_ID_MAX, TEXT_EVENT_MASK, WINDOW_EVENT_MASK, WINDOW_FOCUS_EVENT_MASK, WINDOW_STATE_EVENT_MASKModifier and TypeFieldDescriptionstatic final longThe event mask for selecting action events.static final longThe event mask for selecting adjustment events.static final longThe event mask for selecting component events.protected booleanControls whether or not the event is sent back down to the peer once the source has processed it - false means it's sent to the peer; true means it's not.static final longThe event mask for selecting container events.static final longThe event mask for selecting focus events.static final longThe event mask for selecting hierarchy bounds events.static final longThe event mask for selecting hierarchy events.protected intThe event's id.static final longThe event mask for selecting input method events.static final longThe event mask for selecting invocation events.static final longThe event mask for selecting item events.static final longThe event mask for selecting key events.static final longThe event mask for selecting mouse events.static final longThe event mask for selecting mouse motion events.static final longThe event mask for selecting mouse wheel events.static final longThe event mask for selecting paint events.static final intThe maximum value for reserved AWT event IDs.static final longThe event mask for selecting text events.static final longThe event mask for selecting window events.static final longThe event mask for selecting window focus events.static final longThe event mask for selecting window state events.Fields declared in class EventObject
source -
Constructor Summary
ConstructorsConstructorDescriptionMenuKeyEvent(Component source, int id, long when, int modifiers, int keyCode, char keyChar, MenuElement[] p, MenuSelectionManager m) Constructs a MenuKeyEvent object. -
Method Summary
Modifier and TypeMethodDescriptionReturns the current menu selection manager.getPath()Returns the path to the menu item referenced by this event.Methods declared in class KeyEvent
getExtendedKeyCode, getExtendedKeyCodeForChar, getKeyChar, getKeyCode, getKeyLocation, getKeyModifiersText, getKeyText, isActionKey, paramString, setKeyChar, setKeyCode, setModifiersModifier and TypeMethodDescriptionintReturns an extended key code for the event.static intgetExtendedKeyCodeForChar(int c) Returns an extended key code for a unicode character.charReturns the character associated with the key in this event.intReturns the integer keyCode associated with the key in this event.intReturns the location of the key that originated this key event.static StringgetKeyModifiersText(int modifiers) Deprecated.It is recommended that extended modifier keys andInputEvent.getModifiersExText(int)be used insteadstatic StringgetKeyText(int keyCode) Returns a String describing the keyCode, such as "HOME", "F1" or "A".booleanReturns whether the key in this event is an "action" key.Returns a parameter string identifying this event.voidsetKeyChar(char keyChar) Set the keyChar value to indicate a logical character.voidsetKeyCode(int keyCode) Set the keyCode value to indicate a physical key.voidsetModifiers(int modifiers) Deprecated.as of JDK1.1.4Methods declared in class InputEvent
consume, getMaskForButton, getModifiers, getModifiersEx, getModifiersExText, getWhen, isAltDown, isAltGraphDown, isConsumed, isControlDown, isMetaDown, isShiftDownModifier and TypeMethodDescriptionvoidconsume()Consumes this event so that it will not be processed in the default manner by the source which originated it.static intgetMaskForButton(int button) A method to obtain a mask for any existing mouse button.intDeprecated.It is recommended that extended modifier keys andInputEvent.getModifiersEx()be used insteadintReturns the extended modifier mask for this event.static StringgetModifiersExText(int modifiers) Returns a String describing the extended modifier keys and mouse buttons, such as "Shift", "Button1", or "Ctrl+Shift".longgetWhen()Returns the difference in milliseconds between the timestamp of when this event occurred and midnight, January 1, 1970 UTC.booleanReturns whether or not the Alt modifier is down on this event.booleanReturns whether or not the AltGraph modifier is down on this event.booleanReturns whether or not this event has been consumed.booleanReturns whether or not the Control modifier is down on this event.booleanReturns whether or not the Meta modifier is down on this event.booleanReturns whether or not the Shift modifier is down on this event.Methods declared in class ComponentEvent
getComponentMethods declared in class EventObject
getSourceMethods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()Creates and returns a copy of this object.booleanIndicates whether some other object is "equal to" this one.protected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.Finalization is deprecated and subject to removal in a future release.final Class<?> getClass()Returns the runtime class of thisObject.inthashCode()Returns a hash code value for this object.final voidnotify()Wakes up a single thread that is waiting on this object's monitor.final voidWakes up all threads that are waiting on this object's monitor.final voidwait()Causes the current thread to wait until it is awakened, typically by being notified or interrupted.final voidwait(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.final voidwait(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
-
Constructor Details
-
MenuKeyEvent
public MenuKeyEvent(Component source, int id, long when, int modifiers, int keyCode, char keyChar, MenuElement[] p, MenuSelectionManager m) Constructs a MenuKeyEvent object.- Parameters:
source- the Component that originated the event (typicallythis)id- an int specifying the type of event, as defined inKeyEventwhen- a long identifying the time the event occurredmodifiers- an int specifying any modifier keys held down, as specified inInputEventkeyCode- an int specifying the specific key that was pressedkeyChar- a char specifying the key's character value, if any -- null if the key has no character valuep- an array of MenuElement objects specifying a path to a menu item affected by the dragm- a MenuSelectionManager object that handles selections
-
-
Method Details
-
getPath
Returns the path to the menu item referenced by this event.- Returns:
- an array of MenuElement objects representing the path value
-
getMenuSelectionManager
Returns the current menu selection manager.- Returns:
- a MenuSelectionManager object
-
InputEvent.getModifiersEx()be used instead