java.awt
public class Menu extends MenuItem implements MenuContainer, Serializable
Nested Class Summary | |
---|---|
protected class | Menu.AccessibleAWTMenu
Basic Accessibility class for Menu. |
Constructor Summary | |
---|---|
Menu()
Initializes a new instance of Menu with no label and that
is not a tearoff;
| |
Menu(String label)
Initializes a new instance of Menu that is not a tearoff and
that has the specified label.
| |
Menu(String label, boolean isTearOff)
Initializes a new instance of Menu with the specified
label and tearoff status.
|
Method Summary | |
---|---|
MenuItem | add(MenuItem item)
Adds the specified item to this menu. |
void | add(String label)
Add an item with the specified label to this menu.
|
void | addNotify()
Creates the native peer for this object. |
void | addSeparator()
Adds a separator bar at the current menu location. |
int | countItems()
Returns the number of items in this menu.
|
AccessibleContext | getAccessibleContext()
Gets the AccessibleContext associated with this Menu .
|
MenuItem | getItem(int index)
Returns the item at the specified index.
|
int | getItemCount()
Returns the number of items in this menu.
|
void | insert(MenuItem item, int index)
Inserts the specified menu item into this menu at the specified index. |
void | insert(String label, int index)
Inserts an item with the specified label into this menu at the specified
index. |
void | insertSeparator(int index)
Inserts a separator bar at the specified index value.
|
boolean | isTearOff()
Tests whether or not this menu is a tearoff.
|
String | paramString()
Returns a debugging string for this menu.
|
void | remove(int index)
Deletes the item at the specified index from this menu.
|
void | remove(MenuComponent item)
Removes the specifed item from the menu. |
void | removeAll()
Removes all the elements from this menu. |
void | removeNotify()
Destroys the native peer for this object. |
Menu
with no label and that
is not a tearoff;
Throws: HeadlessException If GraphicsEnvironment.isHeadless() is true.
Menu
that is not a tearoff and
that has the specified label.
Parameters: label The menu label.
Throws: HeadlessException If GraphicsEnvironment.isHeadless() is true.
Menu
with the specified
label and tearoff status.
Parameters: label The label for this menu isTearOff true
if this menu is a tear off menu,
false
otherwise.
Throws: HeadlessException If GraphicsEnvironment.isHeadless() is true.
Parameters: item The new item to add.
Returns: The item that was added.
Parameters: label The label of the menu item to add.
Deprecated: As of JDK 1.1, replaced by getItemCount().
Returns the number of items in this menu.Returns: The number of items in this menu.
Menu
.
The context is created, if necessary.
Returns: the associated context
Parameters: index the item index.
Returns: The item at the specified index.
Throws: ArrayIndexOutOfBoundsException If the index value is not valid.
Returns: The number of items in this menu.
Parameters: item The menu item to add (null
not permitted). index The index of the menu item (>= 0).
Throws: IllegalArgumentException if the index is less than zero. NullPointerException if item
is null
.
Parameters: label The label of the item to add. index The index of the menu item (>= 0).
Throws: IllegalArgumentException If the index is less than zero.
Parameters: index The index at which to insert a separator bar.
Throws: IllegalArgumentException If the index is less than zero. ArrayIndexOutOfBoundsException If the index is otherwise invalid.
Returns: true
if this menu is a tearoff, false
otherwise.
Returns: A debugging string for this menu.
Parameters: index The index of the item to remove.
Throws: ArrayIndexOutOfBoundsException If the index is otherwise invalid.
Parameters: item The component to remove.