Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

java.awt
Class MenuBar  view MenuBar download MenuBar.java

java.lang.Object
  extended byjava.awt.MenuComponent
      extended byjava.awt.MenuBar
All Implemented Interfaces:
javax.accessibility.Accessible, MenuContainer, java.io.Serializable

public class MenuBar
extends MenuComponent
implements MenuContainer, java.io.Serializable, javax.accessibility.Accessible

This class implements a menu bar in the AWT system.


Nested Class Summary
protected  class MenuBar.AccessibleAWTMenuBar
          This class provides accessibility support for AWT menu bars.
 
Nested classes inherited from class java.awt.MenuComponent
MenuComponent.AccessibleAWTMenuComponent
 
Field Summary
private  Menu helpMenu
           
private  java.util.Vector menus
           
private static long serialVersionUID
           
 
Fields inherited from class java.awt.MenuComponent
accessibleContext, focusListener, parent, peer
 
Constructor Summary
MenuBar()
          Initializes a new instance of MenuBar.
 
Method Summary
 Menu add(Menu menu)
          Add a menu to this MenuBar.
 void addNotify()
          Creates this object's native peer.
 int countMenus()
          Deprecated. This method is deprecated in favor of getMenuCount().
 void deleteShortcut(MenuShortcut shortcut)
          Deletes the specified menu shortcut.
 javax.accessibility.AccessibleContext getAccessibleContext()
          Gets the AccessibleContext associated with this MenuBar.
 Menu getHelpMenu()
          Returns the help menu for this menu bar.
 Menu getMenu(int index)
          Returns the menu at the specified index.
 int getMenuCount()
          Returns the number of elements in this menu bar.
 MenuItem getShortcutMenuItem(MenuShortcut shortcut)
          Returns the menu item for the specified shortcut, or null if no such item exists.
 void remove(int index)
          Removes the menu at the specified index.
 void remove(MenuComponent menu)
          Removes the specified menu from the menu bar.
 void removeNotify()
          Destroys this object's native peer.
 void setHelpMenu(Menu menu)
          Sets the help menu for this menu bar.
 java.util.Enumeration shortcuts()
          Returns a list of all shortcuts for the menus in this menu bar.
 
Methods inherited from class java.awt.MenuComponent
dispatchEvent, dispatchEventImpl, getFont, getName, getParent, getPeer, getToolkit, getTreeLock, paramString, postEvent, processEvent, setFont, setName, setParent, setPeer, setTreeLock, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

helpMenu

private Menu helpMenu

menus

private java.util.Vector menus
Constructor Detail

MenuBar

public MenuBar()
Initializes a new instance of MenuBar.

Method Detail

getHelpMenu

public Menu getHelpMenu()
Returns the help menu for this menu bar. This may be null.


setHelpMenu

public void setHelpMenu(Menu menu)
Sets the help menu for this menu bar.


add

public Menu add(Menu menu)
Add a menu to this MenuBar. If the menu has already has a parent, it is first removed from its old parent before being added.


remove

public void remove(int index)
Removes the menu at the specified index.


remove

public void remove(MenuComponent menu)
Removes the specified menu from the menu bar.

Specified by:
remove in interface MenuContainer

getMenuCount

public int getMenuCount()
Returns the number of elements in this menu bar.


countMenus

public int countMenus()
Deprecated. This method is deprecated in favor of getMenuCount().

Returns the number of elements in this menu bar.


getMenu

public Menu getMenu(int index)
Returns the menu at the specified index.


addNotify

public void addNotify()
Creates this object's native peer.


removeNotify

public void removeNotify()
Destroys this object's native peer.

Overrides:
removeNotify in class MenuComponent

shortcuts

public java.util.Enumeration shortcuts()
Returns a list of all shortcuts for the menus in this menu bar.


getShortcutMenuItem

public MenuItem getShortcutMenuItem(MenuShortcut shortcut)
Returns the menu item for the specified shortcut, or null if no such item exists.


deleteShortcut

public void deleteShortcut(MenuShortcut shortcut)
Deletes the specified menu shortcut.


getAccessibleContext

public javax.accessibility.AccessibleContext getAccessibleContext()
Gets the AccessibleContext associated with this MenuBar. The context is created, if necessary.

Specified by:
getAccessibleContext in interface javax.accessibility.Accessible
Overrides:
getAccessibleContext in class MenuComponent