The Menu class represents a group of MenuItem objects. Menus themselves are menu items, allowing you to build multi-level menus. Menus are always attached to MenuBars, which currently can only belong to frames.
public class java.awt.Menu extends java.awt.MenuItem implements java.awt.MenuContainer { // Constructors public Menu(); public Menu (String label); public Menu (String label, boolean tearOff); // Instance Methods public synchronized MenuItem add (MenuItem item); public void add (String label); public void addNotify(); public void addSeparator(); public int countItems(); public MenuItem getItem (int index); public int getItemCount(); public void insert (String label, int index); public synchronized void insert (MenuItem menuitem, int index); public void insertSeparator (int index); public boolean isTearOff(); public String paramString(); public synchronized void remove (int index); public synchronized void remove (MenuComponent component); public synchronized void removeAll(); public void removeNotify(); }
Constructs a Menu object.
Text that appears on Menu.
Constructs a Menu object with the given label.
Text that appears on Menu.
true to create a tear-off menu, false otherwise.
Constructs a Menu object; this will be a tear-off menu if tearOff is set to true.
A MenuItem to add to the Menu.
Item just added.
Adds a new item to a Menu.
Text for a MenuItem
Constructs a new MenuItem object with the given label, and adds it to a Menu.
MenuItem.addNotify()
Creates a Menu peer, and peers for all MenuItem objects that appear on it.
Adds a separator bar to the Menu.
The number of items on the menu. Replaced by getItemCount().
The position of the MenuItem to fetch; the first item has index 0.
The MenuItem at the designated position.
The number of items on the menu.
The label for the new item.
The position for the new item.
Adds a new item to this menu.
The item to add.
The position for the new item.
If index is less than zero.
Adds a new item to this menu.
The position for the separator.
If index is less than zero.
Adds a separator to this menu.
true if the menu is a tear-off menu, false otherwise.
String with current settings of Menu.
MenuItem.paramString()
Helper method for toString() to generate string of current settings.
The position of the MenuItem to remove.
Removes an item from the Menu.
The element to remove.
MenuContainer.remove()
Removes an item from the Menu.
Removes all items from the Menu.
Destroys Menu peer, and peers for all MenuItem objects that appear on it.
Frame, MenuComponent, MenuContainer, MenuItem, String