Class java.awt.MenuBar
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()
Counts the number of menus on the menu bar.
 o getHelpMenu()
Gets the help menu on the menu bar.
 o getMenu(int)
Gets the specified menu.
 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.

Constructors

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

Methods

 o addNotify
public synchronized 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 countMenus
public int countMenus()
Counts the number of menus on the menu bar.
 o getMenu
public Menu getMenu(int i)
Gets the specified menu.
Parameters:
i - the menu to be returned

All Packages  Class Hierarchy  This Package  Previous  Next  Index