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_Z
Modifier and TypeFieldDescriptionstatic final char
KEY_PRESSED and KEY_RELEASED events which do not map to a valid Unicode character use this for the keyChar value.static final int
The first number in the range of ids used for key events.static final int
The last number in the range of ids used for key events.static final int
A 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 int
A constant indicating that the key event originated on the numeric keypad or with a virtual key corresponding to the numeric keypad.static final int
A 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 int
A 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 int
A constant indicating that the keyLocation is indeterminate or not relevant.static final int
The "key pressed" event.static final int
The "key released" event.static final int
The "key typed" event.static final int
Constant for the "0" key.static final int
Constant for the "1" key.static final int
Constant for the "2" key.static final int
Constant for the "3" key.static final int
Constant for the "4" key.static final int
Constant for the "5" key.static final int
Constant for the "6" key.static final int
Constant for the "7" key.static final int
Constant for the "8" key.static final int
Constant for the "9" key.static final int
Constant for the "A" key.static final int
Constant for the Accept or Commit function key.static final int
Constant for the number pad add key.static final int
Constant for the Again key.static final int
Constant for the All Candidates function key.static final int
Constant for the Alphanumeric function key.static final int
Constant for the ALT virtual key.static final int
Constant for the AltGraph function key.static final int
Constant for the "&" key.static final int
Constant for the "*" key.static final int
Constant for the "@" key.static final int
Constant for the "B" key.static final int
Constant for the BACK_QUOTE key.static final int
Constant for the back slash key, "\"static final int
Constant for the BACK_SPACE virtual key.static final int
Constant for the Begin key.static final int
Constant for the "{" key.static final int
Constant for the "}" key.static final int
Constant for the "C" key.static final int
Constant for the CANCEL virtual key.static final int
Constant for the CAPS_LOCK virtual key.static final int
Constant for the "^" key.static final int
Constant for the CLEAR virtual key.static final int
Constant for the close bracket key, "]"static final int
Constant for the Code Input function key.static final int
Constant for the ":" key.static final int
Constant for the comma key, ","static final int
Constant for the Compose function key.static final int
Constant for the Microsoft Windows Context Menu key.static final int
Constant for the CONTROL virtual key.static final int
Constant for the Convert function key.static final int
Constant for the Copy key.static final int
Constant for the Cut key.static final int
Constant for the "D" key.static final int
Constant for the Dead Above Dot key.static final int
Constant for the Dead Above Ring key.static final int
Constant for the Dead Acute key.static final int
Constant for the Dead Breve key.static final int
Constant for the Dead Caron key.static final int
Constant for the Dead Cedilla key.static final int
Constant for the Dead Circumflex key.static final int
Constant for the Dead Diaeresis key.static final int
Constant for the Dead Double Acute key.static final int
Constant for the Dead Grave key.static final int
Constant for the Dead Iota key.static final int
Constant for the Dead Macron key.static final int
Constant for the Dead Ogonek key.static final int
Constant for the Dead Semivoiced Sound key.static final int
Constant for the Dead Tilde key.static final int
Constant for the Dead Voiced Sound key.static final int
Constant for the number pad decimal point key.static final int
Constant for the delete key.static final int
Constant for the number pad divide key.static final int
Constant for the "$" key.static final int
Constant for the non-numpad down arrow key.static final int
Constant for the "E" key.static final int
Constant for the END virtual key.static final int
Constant for the ENTER virtual key.static final int
Constant for the equals key, "="static final int
Constant for the ESCAPE virtual key.static final int
Constant for the Euro currency sign key.static final int
Constant for the "!"static final int
Constant for the "F" key.static final int
Constant for the F1 function key.static final int
Constant for the F10 function key.static final int
Constant for the F11 function key.static final int
Constant for the F12 function key.static final int
Constant for the F13 function key.static final int
Constant for the F14 function key.static final int
Constant for the F15 function key.static final int
Constant for the F16 function key.static final int
Constant for the F17 function key.static final int
Constant for the F18 function key.static final int
Constant for the F19 function key.static final int
Constant for the F2 function key.static final int
Constant for the F20 function key.static final int
Constant for the F21 function key.static final int
Constant for the F22 function key.static final int
Constant for the F23 function key.static final int
Constant for the F24 function key.static final int
Constant for the F3 function key.static final int
Constant for the F4 function key.static final int
Constant for the F5 function key.static final int
Constant for the F6 function key.static final int
Constant for the F7 function key.static final int
Constant for the F8 function key.static final int
Constant for the F9 function key.static final int
Constant for the FINAL key.static final int
Constant for the Find key.static final int
Constant for the Full-Width Characters function key.static final int
Constant for the "G" key.static final int
Constant for the ">" key.static final int
Constant for the "H" key.static final int
Constant for the Half-Width Characters function key.static final int
Constant for the HELP key.static final int
Constant for the Hiragana function key.static final int
Constant for the HOME virtual key.static final int
Constant for the "I" key.static final int
Constant for the input method on/off key.static final int
Constant for the INSERT key.static final int
Constant for the inverted exclamation mark key.static final int
Constant for the "J" key.static final int
Constant for the Japanese-Hiragana function key.static final int
Constant for the Japanese-Katakana function key.static final int
Constant for the Japanese-Roman function key.static final int
Constant for the "K" key.static final int
Constant for the KANA lock key.static final int
Constant for the locking Kana function key.static final int
Constant for KANJI.static final int
Constant for the Katakana function key.static final int
Constant for the numeric keypad down arrow key.static final int
Constant for the numeric keypad left arrow key.static final int
Constant for the numeric keypad right arrow key.static final int
Constant for the numeric keypad up arrow key.static final int
Constant for the "L" key.static final int
Constant for the non-numpad left arrow key.static final int
Constant for the "(" key.static final int
Constant for the "<" key.static final int
Constant for the "M" key.static final int
Constant for the META key.static final int
Constant for the minus key, "-"static final int
Constant for the MODECHANGE key.static final int
Constant for the number pad multiply key.static final int
Constant for the "N" key.static final int
Constant for the Don't Convert function key.static final int
Constant for the NUM_LOCK key.static final int
Constant for the "#" key.static final int
Constant for the number pad "0" key.static final int
Constant for the number pad "1" key.static final int
Constant for the number pad "2" key.static final int
Constant for the number pad "3" key.static final int
Constant for the number pad "4" key.static final int
Constant for the number pad "5" key.static final int
Constant for the number pad "6" key.static final int
Constant for the number pad "7" key.static final int
Constant for the number pad "8" key.static final int
Constant for the number pad "9" key.static final int
Constant for the "O" key.static final int
Constant for the open bracket key, "["static final int
Constant for the "P" key.static final int
Constant for the PAGE_DOWN virtual key.static final int
Constant for the PAGE_UP virtual key.static final int
Constant for the Paste key.static final int
Constant for the PAUSE virtual key.static final int
Constant for the period key, "."static final int
Constant for the "+" key.static final int
Constant for the Previous Candidate function key.static final int
Constant for the PRINTSCREEN key.static final int
Constant for the Props key.static final int
Constant for the "Q" key.static final int
Constant for the QUOTE key.static final int
Constant for the """" key.static final int
Constant for the "R" key.static final int
Constant for the non-numpad right arrow key.static final int
Constant for the ")" key.static final int
Constant for the Roman Characters function key.static final int
Constant for the "S" key.static final int
Constant for the SCROLL_LOCK key.static final int
Constant for the semicolon key, ";"static final int
This constant is obsolete, and is included only for backwards compatibility.static final int
Constant for the Numpad Separator key.static final int
Constant for the SHIFT virtual key.static final int
Constant for the forward slash key, "/"static final int
Constant for the SPACE virtual key.static final int
Constant for the Stop key.static final int
Constant for the number pad subtract key.static final int
Constant for the "T" key.static final int
Constant for the TAB virtual key.static final int
Constant for the "U" key.static final int
This value is used to indicate that the keyCode is unknown.static final int
Constant for the "_" key.static final int
Constant for the Undo key.static final int
Constant for the non-numpad up arrow key.static final int
Constant for the "V" key.static final int
Constant for the "W" key.static final int
Constant for the Microsoft Windows "Windows" key.static final int
Constant for the "X" key.static final int
Constant for the "Y" key.static final int
Constant 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_MASK
Modifier and TypeFieldDescriptionstatic final int
The Alt key extended modifier constant.static final int
The AltGraph key extended modifier constant.static final int
Deprecated.static final int
Deprecated.It is recommended that ALT_DOWN_MASK andInputEvent.getModifiersEx()
be used insteadstatic final int
The Mouse Button1 extended modifier constant.static final int
Deprecated.It is recommended that BUTTON1_DOWN_MASK andInputEvent.getModifiersEx()
be used insteadstatic final int
The Mouse Button2 extended modifier constant.static final int
Deprecated.It is recommended that BUTTON2_DOWN_MASK andInputEvent.getModifiersEx()
be used instead.static final int
The Mouse Button3 extended modifier constant.static final int
Deprecated.It is recommended that BUTTON3_DOWN_MASK andInputEvent.getModifiersEx()
be used instead.static final int
The Control key extended modifier constant.static final int
Deprecated.It is recommended that CTRL_DOWN_MASK andInputEvent.getModifiersEx()
be used insteadstatic final int
The Meta key extended modifier constant.static final int
Deprecated.It is recommended that META_DOWN_MASK andInputEvent.getModifiersEx()
be used insteadstatic final int
The Shift key extended modifier constant.static final int
Deprecated.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_SHOWN
Modifier and TypeFieldDescriptionstatic final int
The first number in the range of ids used for component events.static final int
This event indicates that the component was rendered invisible.static final int
The last number in the range of ids used for component events.static final int
This event indicates that the component's position changed.static final int
This event indicates that the component's size changed.static final int
This 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_MASK
Modifier and TypeFieldDescriptionstatic final long
The event mask for selecting action events.static final long
The event mask for selecting adjustment events.static final long
The event mask for selecting component events.protected boolean
Controls 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 long
The event mask for selecting container events.static final long
The event mask for selecting focus events.static final long
The event mask for selecting hierarchy bounds events.static final long
The event mask for selecting hierarchy events.protected int
The event's id.static final long
The event mask for selecting input method events.static final long
The event mask for selecting invocation events.static final long
The event mask for selecting item events.static final long
The event mask for selecting key events.static final long
The event mask for selecting mouse events.static final long
The event mask for selecting mouse motion events.static final long
The event mask for selecting mouse wheel events.static final long
The event mask for selecting paint events.static final int
The maximum value for reserved AWT event IDs.static final long
The event mask for selecting text events.static final long
The event mask for selecting window events.static final long
The event mask for selecting window focus events.static final long
The 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, setModifiers
Modifier and TypeMethodDescriptionint
Returns an extended key code for the event.static int
getExtendedKeyCodeForChar
(int c) Returns an extended key code for a unicode character.char
Returns the character associated with the key in this event.int
Returns the integer keyCode associated with the key in this event.int
Returns the location of the key that originated this key event.static String
getKeyModifiersText
(int modifiers) Deprecated.It is recommended that extended modifier keys andInputEvent.getModifiersExText(int)
be used insteadstatic String
getKeyText
(int keyCode) Returns a String describing the keyCode, such as "HOME", "F1" or "A".boolean
Returns whether the key in this event is an "action" key.Returns a parameter string identifying this event.void
setKeyChar
(char keyChar) Set the keyChar value to indicate a logical character.void
setKeyCode
(int keyCode) Set the keyCode value to indicate a physical key.void
setModifiers
(int modifiers) Deprecated.as of JDK1.1.4Methods declared in class InputEvent
consume, getMaskForButton, getModifiers, getModifiersEx, getModifiersExText, getWhen, isAltDown, isAltGraphDown, isConsumed, isControlDown, isMetaDown, isShiftDown
Modifier and TypeMethodDescriptionvoid
consume()
Consumes this event so that it will not be processed in the default manner by the source which originated it.static int
getMaskForButton
(int button) A method to obtain a mask for any existing mouse button.int
Deprecated.It is recommended that extended modifier keys andInputEvent.getModifiersEx()
be used insteadint
Returns the extended modifier mask for this event.static String
getModifiersExText
(int modifiers) Returns a String describing the extended modifier keys and mouse buttons, such as "Shift", "Button1", or "Ctrl+Shift".long
getWhen()
Returns the difference in milliseconds between the timestamp of when this event occurred and midnight, January 1, 1970 UTC.boolean
Returns whether or not the Alt modifier is down on this event.boolean
Returns whether or not the AltGraph modifier is down on this event.boolean
Returns whether or not this event has been consumed.boolean
Returns whether or not the Control modifier is down on this event.boolean
Returns whether or not the Meta modifier is down on this event.boolean
Returns whether or not the Shift modifier is down on this event.Methods declared in class ComponentEvent
getComponent
Methods declared in class EventObject
getSource
Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Modifier and TypeMethodDescriptionprotected Object
clone()
Creates and returns a copy of this object.boolean
Indicates whether some other object is "equal to" this one.protected void
finalize()
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
.int
hashCode()
Returns a hash code value for this object.final void
notify()
Wakes up a single thread that is waiting on this object's monitor.final void
Wakes up all threads that are waiting on this object's monitor.final void
wait()
Causes the current thread to wait until it is awakened, typically by being notified or interrupted.final void
wait
(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 void
wait
(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 inKeyEvent
when
- a long identifying the time the event occurredmodifiers
- an int specifying any modifier keys held down, as specified inInputEvent
keyCode
- 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