java.awt
Class MenuBar

java.lang.Object
  |
  +--java.awt.MenuComponent
        |
        +--java.awt.MenuBar
All Implemented Interfaces:
MenuContainer

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:
Frame.setMenuBar(java.awt.MenuBar)

Constructor Summary
MenuBar()
          Creates a new menu bar.
 
Method Summary
 Menu add(Menu m)
          Adds the specified menu to the menu bar.
 void addNotify()
          Creates the menu bar's peer.
 int countMenus()
          Counts the number of menus on the menu bar.
 Menu getHelpMenu()
          Gets the help menu on the menu bar.
 Menu getMenu(int i)
          Gets the specified menu.
 void remove(int index)
          Removes the menu located at the specified index from the menu bar.
 void remove(MenuComponent m)
          Removes the specified menu from the menu bar.
 void removeNotify()
          Removes the menu bar's peer.
 void setHelpMenu(Menu m)
          Sets the help menu to the specified menu on the menu bar.
 
Methods inherited from class java.awt.MenuComponent
getFont, getParent, getPeer, paramString, postEvent, setFont, 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
 

Constructor Detail

MenuBar

public MenuBar()
Creates a new menu bar.

Method Detail

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.


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

getHelpMenu

public Menu getHelpMenu()
Gets the help menu on the menu bar.


setHelpMenu

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

Parameters:
m - the menu to be set

add

public Menu add(Menu m)
Adds the specified menu to the menu bar.

Parameters:
m - the menu to be added to the menu bar

remove

public 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

remove

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

Specified by:
remove in interface MenuContainer
Parameters:
m - the menu to be removed

countMenus

public int countMenus()
Counts the number of menus on the menu bar.


getMenu

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

Parameters:
i - the menu to be returned