java.awt
Class Menu
java.lang.Object
|
+--java.awt.MenuComponent
|
+--java.awt.MenuItem
|
+--java.awt.Menu
All Implemented Interfaces:
MenuContainer, Serializable, Serializable, Serializable
This class represents a pull down or tear off menu in Java's AWT.
Author:- Aaron M. Renn (arenn@urbanophile.com)
Menu
public Menu()
Initializes a new instance of Menu
with no label and that
is not a tearoff;
Throws:
Menu
public Menu(java.lang.String label)
Initializes a new instance of Menu
that is not a tearoff and
that has the specified label.
Parameters:
Throws:
Menu
public Menu(java.lang.String label, boolean isTearOff)
Initializes a new instance of Menu
with the specified
label and tearoff status.
Parameters:
Throws:
add
public MenuItem add(java.awt.MenuItem item)
Adds the specified item to this menu. If it was previously part of
another menu, it is first removed from that menu.
Parameters:
Returns:
add
public void add(java.lang.String label)
Add an item with the specified label to this menu.
Parameters:
addNotify
public void addNotify()
Creates the native peer for this object.
addSeparator
public void addSeparator()
Adds a separator bar at the current menu location.
count
public int count()
Returns the number of items in this menu.
Returns:
- The number of items in this menu.
countItems
public int countItems()
Returns the number of items in this menu.
Returns:
- The number of items in this menu.
getItem
public MenuItem getItem(int index)
Returns the item at the specified index.
Parameters:
Returns:
- The item at the specified index.
Throws:
getItemCount
public int getItemCount()
Returns the number of items in this menu.
Returns:
- The number of items in this menu.
insert
public void insert(java.awt.MenuItem item, int index)
Inserts the specified menu item into this menu at the specified index.
Parameters:
Throws:
insert
public void insert(java.lang.String label, int index)
Inserts an item with the specified label into this menu at the specified index.
Parameters:
Throws:
insertSeparator
public void insertSeparator(int index)
Inserts a separator bar at the specified index value.
Parameters:
Throws:
isTearOff
public boolean isTearOff()
Tests whether or not this menu is a tearoff.
Returns:
true
if this menu is a tearoff, false
otherwise.
paramString
public String paramString()
Returns a debugging string for this menu.
Returns:
- A debugging string for this menu.
remove
public synchronized void remove(int index)
Deletes the item at the specified index from this menu.
Parameters:
Throws:
remove
public void remove(java.awt.MenuComponent item)
Removes the specifed item from the menu. If the specified component
does not exist, this method does nothing. // FIXME: Right?
Parameters:
removeAll
public synchronized void removeAll()
Removes all the elements from this menu.
removeNotify
public void removeNotify()
Destroys the native peer for this object.