Packages This Package Prev Next Index
public  class  java.awt.MenuItem
    extends  java.awt.MenuComponent  (II-§1.31)
{
        // Constructors
    public MenuItem(String  label);	§1.32.1
        // Methods
    public void addNotify();	§1.32.2
    public void disable();	§1.32.3
    public void enable();	§1.32.4
    public void enable(boolean  cond);	§1.32.5
    public String getLabel();	§1.32.6
    public boolean isEnabled();	§1.32.7
    public String paramString();	§1.32.8
    public void setLabel(String  label);	§1.32.9
}
All items in a menu must belong to MenuItem class or a subclass..
The default menu item represents a simple labeled menu item.
The picture of a menu bar (page II-188) shows five menu items. The first two are simple menu items labelled "Basic" and "Simple". Following it is a separator (see §1.32.1). Next is a CheckboxMenuItem (II-§1.7) labelled "Check". Finally, there is a submenu labelled "More Examples", which is an instance of Menu (II-§1.29).
When a menu item is selected, the AWT sends an action event (II-§1.14.13) to the menu item's containing frame. The event's target is the menu item, and its object is the string label of the menu item. Note that the subclass Menu overrides this behavior and does not sent any event to the frame until one of its subitems is selected.
public MenuItem(String  label)
label
- the label for the menu item
public void addNotify()
public void disable()
public void enable()
public void enable(boolean  cond)
cond
- if true, enable this menu item; otherwise disable it
public String getLabel()
public boolean isEnabled()
public String paramString()
public void setLabel(String  label)
label
- the new label, or null for no label
Packages This Package Prev Next IndexJava API Document (HTML generated by dkramer on April 22, 1996)