Packages This Package Prev Next Index
public class java.awt.Menu extends java.awt.MenuItem (II-§1.32) implements java.awt.MenuContainer (II-§1.44) { // Constructors public Menu(String label); §1.29.1 public Menu(String label, boolean tearOff); §1.29.2 // Methods public MenuItem add(MenuItem mi); §1.29.3 public void add(String label); §1.29.4 public void addNotify(); §1.29.5 public void addSeparator(); §1.29.6 public int countItems(); §1.29.7 public MenuItem getItem(int index); §1.29.8 public boolean isTearOff(); §1.29.9 public void remove(int index); §1.29.10 public void remove(MenuComponent item); §1.29.11 public void removeNotify(); §1.29.12 }A menu is a pull-down component of a menu bar.
Each item in a menu must belong to the MenuItem class(II-§1.32). This can be an instance of MenuItem, a submenu (an instance of Menu), or a check box (an instance of CheckboxMenuItem (II-§1.7)).
There is no event associated with clicking on a menu item to pull down the menu.
public Menu(String label)
label
-
the menu's label in the menu bar
public Menu(String label, boolean tearOff)
label
-
the menu's label in the menu bar
tearOff
-
if true, the menu is a tear-off menu
public MenuItem add(MenuItem mi)
mi
-
the menu item to be added
public void add(String label)
label
-
the text on the item
public void addNotify()
public void addSeparator()
public int countItems()
public MenuItem getItem(int index)
index
-
the position of the item to be returned
public boolean isTearOff()
public void remove(int index)
index
-
an index in the menu
public void remove(MenuComponent item)
item
-
the menu component to be removed
public void removeNotify()
Packages This Package Prev Next IndexJava API Document (HTML generated by dkramer on April 22, 1996)