java.awt
public class MenuItem extends MenuComponent implements Serializable, Accessible
| Nested Class Summary | |
|---|---|
| protected class | MenuItem.AccessibleAWTMenuItem |
| Constructor Summary | |
|---|---|
| MenuItem()
Initializes a new instance of MenuItem with no label
and no shortcut. | |
| MenuItem(String label)
Initializes a new instance of MenuItem with the specified
label and no shortcut.
| |
| MenuItem(String label, MenuShortcut shortcut)
Initializes a new instance of MenuItem with the specified
label and shortcut.
| |
| Method Summary | |
|---|---|
| void | addActionListener(ActionListener listener)
Adds the specified listener to the list of registered action listeners
for this component.
|
| void | addNotify()
Creates the native peer for this object. |
| void | deleteShortcut()
Deletes the shortcut for this menu item if one exists. |
| void | disable()
Disables this menu item.
|
| protected void | disableEvents(long events)
Disables the specified events.
|
| void | enable(boolean enabled)
Sets the enabled status of this menu item.
|
| void | enable()
Enables this menu item.
|
| protected void | enableEvents(long events)
Enables the specified events. |
| AccessibleContext | getAccessibleContext()
Gets the AccessibleContext associated with this MenuItem.
|
| String | getActionCommand()
Returns the name of the action command in the action events
generated by this menu item.
|
| ActionListener[] | getActionListeners() |
| String | getLabel()
Returns the label for this menu item, which may be null.
|
| <T extends EventListener> T[] | getListeners(Class<T> listenerType) Returns all registered EventListers of the given listenerType.
listenerType must be a subclass of EventListener, or a
ClassClassException is thrown. |
| MenuShortcut | getShortcut()
Returns the shortcut for this menu item, which may be null.
|
| boolean | isEnabled()
Tests whether or not this menu item is enabled.
|
| String | paramString()
Returns a debugging string for this object.
|
| protected void | processActionEvent(ActionEvent event)
Processes the specified event by dispatching it to any registered listeners.
|
| protected void | processEvent(AWTEvent event)
Processes the specified event by calling processActionEvent()
if it is an instance of ActionEvent.
|
| void | removeActionListener(ActionListener l) |
| void | setActionCommand(String actionCommand)
Sets the name of the action command in the action events generated by
this menu item.
|
| void | setEnabled(boolean enabled)
Sets the enabled status of this menu item.
|
| void | setLabel(String label)
This method sets the label for this menu to the specified value.
|
| void | setShortcut(MenuShortcut shortcut)
Sets the shortcut for this menu item to the specified value. |
MenuItem with no label
and no shortcut.MenuItem with the specified
label and no shortcut.
Parameters: label The label for this menu item.
MenuItem with the specified
label and shortcut.
Parameters: label The label for this menu item. shortcut The shortcut for this menu item.
Parameters: listener The listener to add.
Deprecated: This method is deprecated in favor of setEnabled().
Parameters: events The events to enable, which should be the bit masks
from AWTEvent.
Deprecated: This method is deprecated in favor of setEnabled().
Parameters: enabled true to enable this menu item,
false otherwise.
Deprecated: This method is deprecated in favor of setEnabled().
Parameters: events The events to enable, which should be the bit masks
from AWTEvent.
MenuItem.
The context is created, if necessary.
Returns: the associated context
Returns: The action command name
null.
Returns: The label for this menu item.
Since: 1.3
null.
Returns: The shortcut for this menu item.
Returns: true if this menu item is enabled, false
otherwise.
Returns: A debugging string for this object.
Parameters: event The event to process.
processActionEvent()
if it is an instance of ActionEvent.
Parameters: event The event to process.
Parameters: actionCommand The new action command name.
Parameters: enabled true to enable this menu item,
false otherwise.
Parameters: label The new label for this menu item.
Parameters: shortcut The new shortcut for this menu item.