All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----java.awt.MenuComponent | +----java.awt.MenuItem
MenuItem, or one of its subclasses.
 
 The default MenuItem object embodies
 a simple labeled menu item. 
 
 This picture of a menu bar shows five menu items:
  
 
 
 The first two items are simple menu items, labeled 
 "Basic" and "Simple". 
 Following these two items is a separator, which is itself
 a menu item, created with the label "-". 
 Next is an instance of CheckboxMenuItem 
 labeled "Check". The final menu item is a 
 submenu labeled "More Examples", 
 and this submenu is an instance of Menu. 
 
 When a menu item is selected, AWT sends an action event to 
 the menu item. Since the event is an
 instance of ActionEvent, the processEvent 
 method examines the event and passes it along to 
 processActionEvent. The latter method redirects the
 event to any ActionListener objects that have
 registered an interest in action events generated by this
 menu item. 
 
 
 Note that the subclass Menu overrides this behavior and 
 does not send any event to the frame until one of its subitems is 
 selected.
 
 MenuItem()
	MenuItem()
   MenuItem(String)
	MenuItem(String)
   MenuItem(String, MenuShortcut)
	MenuItem(String, MenuShortcut)
   
 addActionListener(ActionListener)
	addActionListener(ActionListener)
   addNotify()
	addNotify()
   deleteShortcut()
	deleteShortcut()
  MenuShortcut object associated 
 with this menu item.
   disable()
	disable()
   disableEvents(long)
	disableEvents(long)
   enable()
	enable()
   enable(boolean)
	enable(boolean)
   enableEvents(long)
	enableEvents(long)
  
 Since event types are automatically enabled when a listener for 
 that type is added to the menu item, this method only needs 
 to be invoked by subclasses of MenuItem which desire to 
 have the specified event types delivered to processEvent 
 regardless of whether a listener is registered.
  
 getActionCommand()
	getActionCommand()
   getLabel()
	getLabel()
   getShortcut()
	getShortcut()
  MenuShortcut object associated with this
 menu item, 
 
   isEnabled()
	isEnabled()
   paramString()
	paramString()
   processActionEvent(ActionEvent)
	processActionEvent(ActionEvent)
  ActionListener objects.
   processEvent(AWTEvent)
	processEvent(AWTEvent)
   removeActionListener(ActionListener)
	removeActionListener(ActionListener)
   setActionCommand(String)
	setActionCommand(String)
   setEnabled(boolean)
	setEnabled(boolean)
   setLabel(String)
	setLabel(String)
   setShortcut(MenuShortcut)
	setShortcut(MenuShortcut)
  MenuShortcut object associated with this
 menu item.
 
 MenuItem
MenuItem
public MenuItem()
 MenuItem
MenuItem
public MenuItem(String label)
 MenuItem
MenuItem
public MenuItem(String label, MenuShortcut s)
MenuShortcut
                       associated with this menu item.
   
 addNotify
addNotify
public void addNotify()
 getLabel
getLabel
public String getLabel()
null
if this menu item has no label.
     setLabel
setLabel
public synchronized void setLabel(String label)
null for no label.
     isEnabled
isEnabled
public boolean isEnabled()
 setEnabled
setEnabled
public synchronized void setEnabled(boolean b)
true, enables this menu item;
                       if false, disables it.
     enable
enable
public synchronized void enable()
setEnabled(boolean).
 enable
enable
public void enable(boolean b)
setEnabled(boolean).
 disable
disable
public synchronized void disable()
setEnabled(boolean).
 getShortcut
getShortcut
public MenuShortcut getShortcut()
MenuShortcut object associated with this
 menu item,
null if none has been specified.
     setShortcut
setShortcut
public void setShortcut(MenuShortcut s)
MenuShortcut object associated with this
 menu item. If a menu shortcut is already associated with 
 this menu item, it is replaced.
 deleteShortcut
deleteShortcut
public void deleteShortcut()
MenuShortcut object associated 
 with this menu item.
 enableEvents
enableEvents
protected final void enableEvents(long eventsToEnable)
 Since event types are automatically enabled when a listener for 
 that type is added to the menu item, this method only needs 
 to be invoked by subclasses of MenuItem which desire to 
 have the specified event types delivered to processEvent 
 regardless of whether a listener is registered.
 disableEvents
disableEvents
protected final void disableEvents(long eventsToDisable)
 setActionCommand
setActionCommand
public void setActionCommand(String command)
By default, the action command is set to the label of the menu item.
 getActionCommand
getActionCommand
public String getActionCommand()
 addActionListener
addActionListener
public synchronized void addActionListener(ActionListener l)
 removeActionListener
removeActionListener
public synchronized void removeActionListener(ActionListener l)
 processEvent
processEvent
protected void processEvent(AWTEvent e)
ActionEvent, it invokes 
 processActionEvent, another method 
 defined by MenuItem.
 Currently, menu items only support action events.
 processActionEvent
processActionEvent
protected void processActionEvent(ActionEvent e)
ActionListener objects.
 This method is not called unless action events are 
 enabled for this component. Action events are enabled 
 when one of the following occurs:
 ActionListener object is registered 
 via addActionListener.
 enableEvents.
 
 paramString
paramString
public String paramString()
All Packages Class Hierarchy This Package Previous Next Index