java.awt
Class MenuItem

java.lang.Object
  |
  +--java.awt.MenuComponent
        |
        +--java.awt.MenuItem
Direct Known Subclasses:
CheckboxMenuItem, Menu

public class MenuItem
extends MenuComponent

A String item that represents a choice in a menu.


Constructor Summary
MenuItem(String label)
          Constructs a new MenuItem with the specified label.
 
Method Summary
 void addNotify()
          Creates the menu item's peer.
 void disable()
          Makes this menu item unselectable by the user.
 void enable()
          Makes this menu item selectable by the user.
 void enable(boolean cond)
          Conditionally enables a component.
 String getLabel()
          Gets the label for this menu item.
 boolean isEnabled()
          Checks whether the menu item is enabled.
 String paramString()
          Returns the String parameter of the menu item.
 void setLabel(String label)
          Sets the label to be the specified label.
 
Methods inherited from class java.awt.MenuComponent
getFont, getParent, getPeer, postEvent, removeNotify, setFont, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MenuItem

public MenuItem(String label)
Constructs a new MenuItem with the specified label.

Parameters:
label - the label for this menu item. Note that "-" is reserved to mean a separator between menu items.
Method Detail

addNotify

public void addNotify()
Creates the menu item's peer. The peer allows us to modify the appearance of the menu item without changing its functionality.


getLabel

public String getLabel()
Gets the label for this menu item.


setLabel

public void setLabel(String label)
Sets the label to be the specified label.

Parameters:
label - the label for this menu item

isEnabled

public boolean isEnabled()
Checks whether the menu item is enabled.


enable

public void enable()
Makes this menu item selectable by the user.


enable

public void enable(boolean cond)
Conditionally enables a component.

Parameters:
cond - enabled if true; disabled otherwise.
See Also:
enable(), disable()

disable

public void disable()
Makes this menu item unselectable by the user.


paramString

public String paramString()
Returns the String parameter of the menu item.

Overrides:
paramString in class MenuComponent