Contents | Package | Class | Tree | Deprecated | Index | Help | Java 1.2 Beta 3 | ||
PREV | NEXT | SHOW LISTS | HIDE LISTS |
java.lang.Object | +----java.awt.MenuComponent | +----java.awt.MenuBar
MenuBar
class encapsulates the platform's
concept of a menu bar bound to a frame. In order to associate
the menu bar with a Frame
object, call the
frame's setMenuBar
method.
This is what a menu bar might look like:
A menu bar handles keyboard shortcuts for menu items, passing them
along to its child menus.
(Keyboard shortcuts, which are optional, provide the user with
an alternative to the mouse for invoking a menu item and the
action that is associated with it.)
Each menu item can maintain an instance of MenuShortcut
.
The MenuBar
class defines several methods,
shortCuts
and
getShortcutMenuItem
that retrieve information about the shortcuts a given
menu bar is managing.
Constructor Summary | |
MenuBar()
|
Method Summary | |
Menu | add(Menu m)
|
void | addNotify()
|
int | countMenus()
|
void | deleteShortcut(MenuShortcut s)
|
Menu | getHelpMenu()
|
Menu | getMenu(int i)
|
int | getMenuCount()
|
MenuItem | getShortcutMenuItem(MenuShortcut s)
MenuItem associated
with the specified MenuShortcut object,
or null if none has been specified.
|
void | remove(int index)
|
void | remove(MenuComponent m)
|
void | removeNotify()
|
void | setHelpMenu(Menu m)
|
Enumeration | shortcuts()
|
Methods inherited from class java.awt.MenuComponent |
dispatchEvent, getFont, getName, getParent, getPeer, paramString, postEvent, processEvent, removeNotify, setFont, setName, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MenuBar()
Method Detail |
public void addNotify()
public void removeNotify()
public Menu getHelpMenu()
public void setHelpMenu(Menu m)
m
- the menu to be set as the help menu.
public Menu add(Menu m)
m
- the menu to be added.
public void remove(int index)
index
- the position of the menu to be removed.
public void remove(MenuComponent m)
m
- the menu component to be removed.
public int getMenuCount()
public int countMenus()
getMenuCount()
.
public Menu getMenu(int i)
i
- the index position of the menu to be returned.
public Enumeration shortcuts()
public MenuItem getShortcutMenuItem(MenuShortcut s)
MenuItem
associated
with the specified MenuShortcut
object,
or null
if none has been specified.
s
- the specified menu shortcut.
public void deleteShortcut(MenuShortcut s)
s
- the menu shortcut to delete.
Contents | Package | Class | Tree | Deprecated | Index | Help | Java 1.2 Beta 3 | ||
PREV | NEXT | SHOW LISTS | HIDE LISTS |