java.awt
Class Menu
- Accessible, MenuContainer, Serializable
This class represents a pull down or tear off menu in Java's AWT.
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.
|
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() - As of JDK 1.1, replaced by getItemCount().
|
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.
|
addActionListener , addNotify , deleteShortcut , disable , disableEvents , enable , enable , enableEvents , extends EventListener> T[] getListeners , getAccessibleContext , getActionCommand , getActionListeners , getLabel , getShortcut , isEnabled , paramString , processActionEvent , processEvent , removeActionListener , setActionCommand , setEnabled , setLabel , setShortcut |
dispatchEvent , getAccessibleContext , getFont , getName , getParent , getPeer , getTreeLock , paramString , postEvent , processEvent , removeNotify , setFont , setName , toString |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
Menu
public Menu()
Initializes a new instance of Menu
with no label and that
is not a tearoff;
Menu
public Menu(String label)
Initializes a new instance of Menu
that is not a tearoff and
that has the specified label.
Menu
public Menu(String label,
boolean isTearOff)
Initializes a new instance of Menu
with the specified
label and tearoff status.
label
- The label for this menuisTearOff
- true
if this menu is a tear off menu,
false
otherwise.
add
public MenuItem add(MenuItem item)
Adds the specified item to this menu. If it was previously part of
another menu, it is first removed from that menu.
item
- The new item to add.
add
public void add(String label)
Add an item with the specified label to this menu.
label
- The label of the menu item to add.
addSeparator
public void addSeparator()
Adds a separator bar at the current menu location.
countItems
public int countItems()
As of JDK 1.1, replaced by getItemCount().
Returns the number of items in this menu.
- The number of items in this menu.
getItem
public MenuItem getItem(int index)
Returns the item at the specified index.
- The item at the specified index.
getItemCount
public int getItemCount()
Returns the number of items in this menu.
- The number of items in this menu.
insert
public void insert(MenuItem item,
int index)
Inserts the specified menu item into this menu at the specified index. If
the index is greater than or equal to the number of items already in the
menu, the new item is added as the last item in the menu.
item
- The menu item to add (null
not permitted).index
- The index of the menu item (>= 0).
insert
public void insert(String label,
int index)
Inserts an item with the specified label into this menu at the specified
index. If the index is greater than or equal to the number of items
already in the menu, the new item is added as the last item in the menu.
label
- The label of the item to add.index
- The index of the menu item (>= 0).
insertSeparator
public void insertSeparator(int index)
Inserts a separator bar at the specified index value.
index
- The index at which to insert a separator bar.
isTearOff
public boolean isTearOff()
Tests whether or not this menu is a tearoff.
true
if this menu is a tearoff, false
otherwise.
remove
public void remove(int index)
Deletes the item at the specified index from this menu.
index
- The index of the item to remove.
remove
public void remove(MenuComponent item)
Removes the specifed item from the menu. If the specified component
does not exist, this method does nothing.
- remove in interface MenuContainer
item
- The component to remove.
removeAll
public void removeAll()
Removes all the elements from this menu.
Menu.java -- A Java AWT Menu
Copyright (C) 1999, 2002, 2004, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.