Package java.awt |
![]() Previous |
![]() Java API |
![]() Index |
![]() Next |
public class java.awt.MenuBar extends java.awt.MenuComponent implements java.awt.MenuContainer { // Constructors public MenuBar(); // Methods public Menu add(Menu m); public void addNotify(); public int countMenus(); public Menu getHelpMenu(); public Menu getMenu(int i); public void remove(int index); public void remove(MenuComponent m); public void removeNotify(); public void setHelpMenu(Menu m); }
This class that encapsulates the platform's concept of a menu bar bound to a Frame.
In order to attach the menu bar to a frame, the setMenuBar method in class Frame must be called.
This is what a menubar looks like:
public MenuBar()Creates a new menu bar.
public Menu add(Menu m)Adds the specified menu to this menu bar.
Return Value:
Returns the menu added.
Parameter Description m the menu to be added
public void addNotify()This method calls the createMenuBar method of this object's toolkit in order to create a MenuBarPeer for this menu bar. This peer allows the application to change the look of a menu barwithout changing its functionality.
Most applications do not call this method directly.
public int countMenus()Return Value:
Returns the number of menus on this menu bar.
public Menu getHelpMenu()Return Value:
Returns the help menu on this menu bar.
public Menu getMenu(int i)Return Value:
Returns the menu at the specified index of this menu bar.
Parameter Description i the position of the menu to be returned
public void remove(int index)Removes the menu located at the specified index from this menu bar.
Parameter Description index the position of the menu to be removed
public void remove(MenuComponent m)Removes the specified menu component from this menu bar.
Parameter Description m the menu component to be removed
public void removeNotify()Notifies this menu bar to destroy its peer.
This menu bar also notifies each of its menus to destroy their peers.
Overrides:
removeNotify in class MenuComponent .
public void setHelpMenu(Menu m)Sets the help menu on this menu bar to be the specified menu.
Parameter Description m the help menu