java.awt.MenuItem (JDK 1.0)
This class encapsulates a menu item with a specified textual label. A MenuItem can be added to a menu pane with the Menu.add() method. The disable() method makes an item non-selectable; you might use it to "gray-out" a menu item when the command it represents is not valid in the current context. The enable() method makes an item selectable again. In Java 1.1, use setActionCommand() to specify an identifying string that is included in ActionEvent events generated by the menu item.
public classMenuItemextends MenuComponent { //Public Constructors1.1 publicMenuItem(); publicMenuItem(Stringlabel); 1.1 publicMenuItem(Stringlabel, MenuShortcuts); //Public Instance Methods1.1 public synchronized voidaddActionListener(ActionListenerl); public voidaddNotify(); 1.1 public voiddeleteShortcut(); # public synchronized voiddisable(); # public synchronized voidenable(); # public voidenable(booleanb); 1.1 public StringgetActionCommand(); public StringgetLabel(); 1.1 public MenuShortcutgetShortcut(); public booleanisEnabled(); public StringparamString(); //Overrides MenuComponent1.1 public synchronized voidremoveActionListener(ActionListenerl); 1.1 public voidsetActionCommand(Stringcommand); 1.1 public synchronized voidsetEnabled(booleanb); public synchronized voidsetLabel(Stringlabel); 1.1 public voidsetShortcut(MenuShortcuts); //Protected Instance Methods1.1 protected final voiddisableEvents(longeventsToDisable); 1.1 protected final voidenableEvents(longeventsToEnable); 1.1 protected voidprocessActionEvent(ActionEvente); 1.1 protected voidprocessEvent(AWTEvente); //Overrides MenuComponent}
Hierarchy:
Object->MenuComponent(Serializable)->MenuItem
Extended By:
CheckboxMenuItem, Menu
Passed To:
Menu.add(), Menu.insert(), MenuPeer.addItem(), Toolkit.createMenuItem()
Returned By:
Menu.add(), Menu.getItem(), MenuBar.getShortcutMenuItem()