
 |
Chapter 19 java.awt Reference |
 |
Menu
Name
Menu
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.
- Description
-
Constructs a Menu object.
- Parameters
-
- label
-
Text that appears on
Menu.
- Description
-
Constructs a Menu object with
the given label.
- Parameters
-
- label
-
Text that appears on
Menu.
- tearOff
-
true
to create a tear-off menu, false
otherwise.
- Description
-
Constructs a Menu object; this
will be a tear-off menu if tearOff
is set to true.
- Parameters
-
- item
-
A MenuItem
to add to the Menu.
- Returns
-
Item just added.
- Description
-
Adds a new item to a Menu.
- Parameters
-
- label
-
Text for a MenuItem
- Description
-
Constructs a new MenuItem object
with the given label, and adds it to a Menu.
- Overrides
-
MenuItem.addNotify()
- Description
-
Creates a Menu peer, and peers
for all MenuItem objects that
appear on it.
- Description
-
Adds a separator bar to the Menu.
- Returns
-
The number of items on the menu. Replaced by getItemCount().
- Parameters
-
- index
-
The position of the MenuItem
to fetch; the first item has index 0.
- Returns
-
The MenuItem at the designated
position.
- Returns
-
The number of items on the menu.
- Parameters
-
- label
-
The label for the new item.
- index
-
The position for the new item.
- Description
-
Adds a new item to this menu.
- Parameters
-
- menuitem
-
The item to add.
- index
-
The position for the new item.
- Throws
-
- IllegalArgumentException
-
If
index is less than zero.
- Description
-
Adds a new item to this menu.
- Parameters
-
- index
-
The position for the separator.
- Throws
-
- IllegalArgumentException
-
If
index is less than zero.
- Description
-
Adds a separator to this menu.
- Returns
-
true if the menu is a tear-off
menu, false otherwise.
- Returns
-
String with current settings of Menu.
- Overrides
-
MenuItem.paramString()
- Description
-
Helper method for toString()
to generate string of current settings.
- Parameters
-
- index
-
The position of the MenuItem
to remove.
- Description
-
Removes an item from the Menu.
- Parameters
-
- component
-
The element to remove.
- Implements
-
MenuContainer.remove()
- Description
-
Removes an item from the Menu.
- Description
-
Removes all items from the Menu.
- Description
-
Destroys Menu peer, and peers
for all MenuItem objects that
appear on it.
Frame, MenuComponent,
MenuContainer, MenuItem,
String
|
|