Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
java.awt

Class MenuBar

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

All Implemented Interfaces:

MenuContainer, Serializable, Serializable


public class MenuBar

extends MenuComponent

implements MenuContainer, Serializable

This class implements a menu bar in the AWT system.

Authors:

Constructor Summary

MenuBar()

Initializes a new instance of MenuBar.

Method Summary

synchronized java.awt.Menuadd(java.awt.Menu menu)

Add a menu to this MenuBar.
voidaddNotify()

Creates this object's native peer.
intcountMenus()

Returns the number of elements in this menu bar.
voiddeleteShortcut(java.awt.MenuShortcut shortcut)

Deletes the specified menu shortcut.
java.awt.MenugetHelpMenu()

Returns the help menu for this menu bar.
java.awt.MenugetMenu(int index)

Returns the menu at the specified index.
intgetMenuCount()

Returns the number of elements in this menu bar.
java.awt.MenuItemgetShortcutMenuItem(java.awt.MenuShortcut shortcut)

Returns the menu item for the specified shortcut, or null if no such item exists.
synchronized voidremove(int index)

Removes the menu at the specified index.
voidremove(java.awt.MenuComponent menu)

Removes the specified menu from the menu bar.
voidremoveNotify()

Destroys this object's native peer.
synchronized voidsetHelpMenu(java.awt.Menu menu)

Sets the help menu for this menu bar.
synchronized java.util.Enumerationshortcuts()

Returns a list of all shortcuts for the menus in this menu bar.

Constructor Details

MenuBar

public MenuBar()

Initializes a new instance of MenuBar.

Throws:


Method Details

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:


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:


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:


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:


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: