    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

##

MenuBar()
  Creates a new menu bar.

##

add(Menu)
  Adds the specified menu to the menu bar.
addNotify()
  Creates the menu bar's peer.
countMenus()
  Deprecated.
deleteShortcut(MenuShortcut)
  Delete the specified MenuShortcut.
getHelpMenu()
  Gets the help menu on the menu bar.
getMenu(int)
  Gets the specified menu.
getMenuCount()
  Counts the number of menus on the menu bar.
getShortcutMenuItem(MenuShortcut)
  Return the MenuItem associated with a MenuShortcut, or null if none has been specified.
remove(int)
  Removes the menu located at the specified index from the menu bar.
remove(MenuComponent)
  Removes the specified menu from the menu bar.
removeNotify()
  Removes the menu bar's peer.
setHelpMenu(Menu)
  Sets the help menu to the specified menu on the menu bar.
shortcuts()
  Get an Enumeration of all MenuShortcuts this MenuBar manages.

##

MenuBar

      public MenuBar()

  Creates a new menu bar.

##

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 synchronized 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 synchronized 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 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

remove

      public synchronized void remove(MenuComponent m)

  Removes the specified menu from the menu bar.

  Parameters:
    m - the menu to be removed

getMenuCount

      public int getMenuCount()

  Counts the number of menus on the menu bar.

countMenus

      public int countMenus()

  Note: countMenus() is deprecated. As of JDK version 1.1, replaced by getMenuCount().

getMenu

      public Menu getMenu(int i)

  Gets the specified menu.

  Parameters:
    i - the menu to be returned

shortcuts

      public synchronized Enumeration shortcuts()

  Get an Enumeration of all MenuShortcuts this MenuBar manages.

getShortcutMenuItem

      public MenuItem getShortcutMenuItem(MenuShortcut s)

  Return the MenuItem associated with a MenuShortcut, or null if none has been specified.

  Parameters:
    s - the MenuShortcut to search for

deleteShortcut

      public void deleteShortcut(MenuShortcut s)

  Delete the specified MenuShortcut.

  Parameters:
    s - the MenuShortcut to delete

    All Packages  Class Hierarchy  This Package  Previous  Next  Index