The MenuItem class represents a selectable item on a menu.
public class java.awt.MenuItem extends java.awt.MenuComponent { // Constructors public MenuItem(); public MenuItem (String label); public MenuItem (String label, MenuShortcut s); // Instance Methods public void addActionListener (ActionListener l); public void addNotify(); public void deleteShortcut(); public synchronized void disable(); public synchronized void enable(); public void enable (boolean condition); public String getActionCommand(); public String getLabel(); public MenuShortcut getShortcut(); public boolean isEnabled(); public String paramString(); public void removeActionListener (ActionListener l); public void setActionCommand (String command); public synchronized void setEnabled (boolean b); public synchronized void setLabel (String label); public void setShortcut (MenuShortcut s); // Protected Instance Methods protected final void disableEvents (long eventsToDisable); protected final void enableEvents (long eventsToEnable); protected void processActionEvent (ActionEvent e); protected void processEvent (AWTEvent e); }
Constructs a MenuItem object with no label or shortcut.
Text that appears on the MenuItem.
Constructs a MenuItem object.
Text that appears on the MenuItem.
Shortcut for the MenuItem.
Constructs a MenuItem object with the given shortcut.
An object that implements the ActionListener interface.
Add a listener for the action event.
Creates the MenuItem's peer.
Removes the shortcut associated with this item.
Disables the menu component so that it is unresponsive to user interactions. Replaced by setEnabled(false).
Enables the menu component so that it is responsive to user interactions. Replaced by setEnabled(true).
true to enable the menu component; false to disable it.
Enables or disables the menu component, depending on the condition parameter. Replaced by setEnabled(boolean).
Current action command string.
Returns the string used for the action command.
The current text associated with the MenuItem.
The current shortcut for this item, or null if there is none.
true if the menu item is enabled, false otherwise.
String with current settings of MenuItem.
Helper method for toString() to generate string of current settings.
One of this Button's ActionListeners.
Remove an action event listener.
New action command string.
Specify the string used for the action command.
true to enable the item, false to disable it.
Enables or disables the item. Replaces enable(), enable(boolean), and disable().
New text to appear on MenuItem.
Changes the label of the MenuItem.
New shortcut for the MenuItem.
Changes the shortcut of the MenuItem.
A value representing certain kinds of events. This can be constructed by ORing the event mask constants defined in java.awt.AWTEvent.
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.
A value representing certain kinds of events. This can be constructed by ORing the event mask constants defined in java.awt.AWTEvent.
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.
The action event to process.
Action events are passed to this method for processing. Normally, this method is called by processEvent().
The event to process.
Low-level AWTEvents are passed to this method for processing.
CheckboxMenuItem, Menu, MenuComponent, MenuShortcut, String
This HTML Help has been published using the chm2web software. |