Redes

Solo disponible en BuenasTareas
  • Páginas : 92 (22929 palabras )
  • Descarga(s) : 0
  • Publicado : 29 de agosto de 2010
Leer documento completo
Vista previa del texto
Class MenuItem
java.lang.Object
java.awt.MenuComponent
java.awt.MenuItem
All Implemented Interfaces:
Accessible, Serializable
Direct Known Subclasses:
CheckboxMenuItem, Menu

public class MenuItem
extends MenuComponent
implements Accessible
All items in a menu must belong to the class MenuItem, or one of its subclasses.
The default MenuItem object embodies a simplelabeled 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 thisbehavior and does not send any event to the frame until one of its subitems is selected.
See Also:
Serialized Form

Nested Class Summary |
protected  class | MenuItem.AccessibleAWTMenuItem
          Inner class of MenuItem used to provide default support for accessibility. |
 
Nested classes inherited from class java.awt.MenuComponent |
MenuComponent.AccessibleAWTMenuComponent |
 Constructor Summary |
MenuItem()
          Constructs a new MenuItem with an empty label and no keyboard shortcut. | |
MenuItem(String label)
          Constructs a new MenuItem with the specified label and no keyboard shortcut. | |
MenuItem(String label, MenuShortcut s)
          Create a menu item with an associated keyboard shortcut. | |
 
Method Summary |
 void |addActionListener(ActionListener l)
          Adds the specified action listener to receive action events from this menu item. |
 void | addNotify()
          Creates the menu item's peer. |
 void | deleteShortcut()
          Delete any MenuShortcut object associated with this menu item. |
 void | disable()
          Deprecated. As of JDK version 1.1, replaced by setEnabled(boolean). |protected  void | disableEvents(long eventsToDisable)
          Disables event delivery to this menu item for events defined by the specified event mask parameter. |
 void | enable()
          Deprecated. As of JDK version 1.1, replaced by setEnabled(boolean). |
 void | enable(boolean b)
          Deprecated. As of JDK version 1.1, replaced by setEnabled(boolean). |
protected  void |enableEvents(long eventsToEnable)
          Enables event delivery to this menu item for events to be defined by the specified event mask parameter |
 AccessibleContext | getAccessibleContext()
          Gets the AccessibleContext associated with this MenuItem. |
 String | getActionCommand()
          Gets the command name of the action event that is fired by this menu item. | ActionListener[] | getActionListeners()
          Returns an array of all the action listeners registered on this menu item. |
 String | getLabel()
          Gets the label for this menu item. |
 EventListener[] | getListeners(Class listenerType)
          Returns an array of all the objects currently registered as FooListeners upon this MenuItem. |
 MenuShortcut | getShortcut()          Get the MenuShortcut object associated with this menu item, |
 boolean | isEnabled()
          Checks whether this menu item is enabled. |
 String | paramString()
          Returns a string representing the state of this MenuItem. |
protected  void | processActionEvent(ActionEvent e)
          Processes action events occurring on this menu item, by dispatching them to any registered...
tracking img