All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.awt.MenuBar

java.lang.Object
   |
   +----java.awt.MenuComponent
           |
           +----java.awt.MenuBar

public class MenuBar
extends MenuComponent
implements MenuContainer
A class that encapsulates the platform's concept of a menu bar bound to a Frame. In order to associate the MenuBar with an actual Frame, the Frame.setMenuBar() method should be called.

See Also:
setMenuBar

Constructor Index

 o MenuBar()
Creates a new menu bar.

Method Index

 o add(Menu)
Adds the specified menu to the menu bar.
 o addNotify()
Creates the menu bar's peer.
 o countMenus()
Deprecated.
 o deleteShortcut(MenuShortcut)
Delete the specified MenuShortcut.
 o getHelpMenu()
Gets the help menu on the menu bar.
 o getMenu(int)
Gets the specified menu.
 o getMenuCount()
Counts the number of menus on the menu bar.
 o getShortcutMenuItem(MenuShortcut)
Return the MenuItem associated with a MenuShortcut, or null if none has been specified.
 o remove(int)
Removes the menu located at the specified index from the menu bar.
 o remove(MenuComponent)
Removes the specified menu from the menu bar.
 o removeNotify()
Removes the menu bar's peer.
 o setHelpMenu(Menu)
Sets the help menu to the specified menu on the menu bar.
 o shortcuts()
Get an Enumeration of all MenuShortcuts this MenuBar manages.

Constructors

 o MenuBar
 public MenuBar()
Creates a new menu bar.

Methods

 o addNotify
 public void addNotify()
Creates the menu bar's peer. The peer allows us to change the appearance of the menu bar without changing any of the menu bar's functionality.

 o removeNotify
 public void removeNotify()
Removes the menu bar's peer. The peer allows us to change the appearance of the menu bar without changing any of the menu bar's functionality.

Overrides:
removeNotify in class MenuComponent
 o getHelpMenu
 public Menu getHelpMenu()
Gets the help menu on the menu bar.

 o setHelpMenu
 public synchronized void setHelpMenu(Menu m)
Sets the help menu to the specified menu on the menu bar.

Parameters:
m - the menu to be set
 o add
 public synchronized Menu add(Menu m)
Adds the specified menu to the menu bar.

Parameters:
m - the menu to be added to the menu bar
 o remove
 public synchronized void remove(int index)
Removes the menu located at the specified index from the menu bar.

Parameters:
index - the position of the menu to be removed
 o remove
 public synchronized void remove(MenuComponent m)
Removes the specified menu from the menu bar.

Parameters:
m - the menu to be removed
 o getMenuCount
 public int getMenuCount()
Counts the number of menus on the menu bar.

 o countMenus
 public int countMenus()
Note: countMenus() is deprecated. As of JDK version 1.1, replaced by getMenuCount().

 o getMenu
 public Menu getMenu(int i)
Gets the specified menu.

Parameters:
i - the menu to be returned
 o shortcuts
 public synchronized Enumeration shortcuts()
Get an Enumeration of all MenuShortcuts this MenuBar manages.

 o getShortcutMenuItem
 public MenuItem getShortcutMenuItem(MenuShortcut s)
Return the MenuItem associated with a MenuShortcut, or null if none has been specified.

Parameters:
s - the MenuShortcut to search for
 o deleteShortcut
 public void deleteShortcut(MenuShortcut s)
Delete the specified MenuShortcut.

Parameters:
s - the MenuShortcut to delete

All Packages  Class Hierarchy  This Package  Previous  Next  Index