
 |
Chapter 19 java.awt Reference |
 |
MenuItem
Name
MenuItem
The MenuItem class represents
a selectable item on a menu.
- Description
-
Constructs a MenuItem object
with no label or shortcut.
- Parameters
-
- label
-
Text that appears on
the MenuItem.
- Description
-
Constructs a MenuItem object.
- Parameters
-
- label
-
Text that appears on
the MenuItem.
- s
-
Shortcut for the MenuItem.
- Description
-
Constructs a MenuItem object
with the given shortcut.
- Parameters
-
- l
-
An object that implements the ActionListener
interface.
- Description
-
Add a listener for the action event.
- Description
-
Creates the MenuItem's
peer.
- Description
-
Removes the shortcut associated with this item.
- Description
-
Disables the menu component so that it is unresponsive to user interactions.
Replaced by setEnabled(false).
- Description
-
Enables the menu component so that it is responsive to user interactions.
Replaced by setEnabled(true).
- Parameters
-
- condition
-
true to enable
the menu component; false to
disable it.
- Description
-
Enables or disables the menu component, depending on the condition
parameter. Replaced by setEnabled(boolean).
- Returns
-
Current action command string.
- Description
-
Returns the string used for the action command.
- Returns
-
The current text associated with the MenuItem.
- Returns
-
The current shortcut for this item, or null
if there is none.
- Returns
-
true if the menu item is enabled,
false otherwise.
- Returns
-
String with current settings of MenuItem.
- Description
-
Helper method for toString()
to generate string of current settings.
- Parameters
-
- l
-
One of this Button's
ActionListeners.
- Description
-
Remove an action event listener.
- Parameters
-
- command
-
New action command string.
- Description
-
Specify the string used for the action command.
- Parameters
-
- b
-
true to enable
the item, false to disable
it.
- Description
-
Enables or disables the item. Replaces enable(),
enable(boolean), and disable().
- Parameters
-
- label
-
New text to appear on MenuItem.
- Description
-
Changes the label of the MenuItem.
- Parameters
-
- s
-
New shortcut for the MenuItem.
- Description
-
Changes the shortcut of the MenuItem.
- Parameters
-
- eventsToDisable
-
A value representing certain kinds of events. This can
be constructed by ORing the event mask constants defined in java.awt.AWTEvent.
- Description
-
By default, a menu item receives events corresponding to the event listeners
that have registered. If a menu item should not receive events of a certain
type, even if there is a listener registered for that type of event, this
method can be used to disable that event type.
- Parameters
-
- eventsToDisable
-
A value representing certain kinds of events. This can
be constructed by ORing the event mask constants defined in java.awt.AWTEvent.
- Description
-
By default, a menu item receives events corresponding to the event listeners
that have registered. If a menu item should receive other types of events
as well, this method can be used to get them.
- Parameters
-
- e
-
The action event to process.
- Description
-
Action events are passed to this method for processing. Normally, this
method is called by processEvent().
- Parameters
-
- e
-
The event to process.
- Description
-
Low-level AWTEvents are passed
to this method for processing.
CheckboxMenuItem, Menu,
MenuComponent, MenuShortcut,
String
|