java.awt
Class MenuBar
java.lang.Object
|
+--java.awt.MenuComponent
|
+--java.awt.MenuBar
All Implemented Interfaces:
MenuContainer, Serializable, Serializable
This class implements a menu bar in the AWT system.
Authors:- Aaron M. Renn (arenn@urbanophile.com)
- Tom Tromey <tromey@redhat.com>
MenuBar
public MenuBar()
Initializes a new instance of MenuBar
.
Throws:
add
public synchronized Menu add(java.awt.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.
Parameters:
Returns:
addNotify
public void addNotify()
Creates this object's native peer.
countMenus
public int countMenus()
Returns the number of elements in this menu bar.
Returns:
- The number of elements in the menu bar.
deleteShortcut
public void deleteShortcut(java.awt.MenuShortcut shortcut)
Deletes the specified menu shortcut.
Parameters:
getHelpMenu
public Menu getHelpMenu()
Returns the help menu for this menu bar. This may be null
.
Returns:
- The help menu for this menu bar.
getMenu
public Menu getMenu(int index)
Returns the menu at the specified index.
Parameters:
Returns:
Throws:
getMenuCount
public int getMenuCount()
Returns the number of elements in this menu bar.
Returns:
- The number of elements in the menu bar.
getShortcutMenuItem
public MenuItem getShortcutMenuItem(java.awt.MenuShortcut shortcut)
Returns the menu item for the specified shortcut, or null
if no such item exists.
Parameters:
Returns:
- The menu item for the specified shortcut.
remove
public synchronized void remove(int index)
Removes the menu at the specified index.
Parameters:
remove
public void remove(java.awt.MenuComponent menu)
Removes the specified menu from the menu bar.
Parameters:
removeNotify
public void removeNotify()
Destroys this object's native peer.
setHelpMenu
public synchronized void setHelpMenu(java.awt.Menu menu)
Sets the help menu for this menu bar.
Parameters:
shortcuts
public synchronized Enumeration shortcuts()
Returns a list of all shortcuts for the menus in this menu bar.
Returns:
- A list of all shortcuts for the menus in this menu bar.