public class SelectionMenu
extends java.awt.Menu
implements java.awt.event.ActionListener, java.awt.event.ItemListener
SelectionMenu object is a pull-down menu component that is
deployed from a menu bar. It can select one of the
CheckboxMenuItems.| コンストラクタと説明 |
|---|
SelectionMenu()
Constructs a new menu with an empty label.
|
SelectionMenu(java.lang.String label)
Constructs a new menu with the specified label.
|
SelectionMenu(java.lang.String label,
boolean tearOff)
Constructs a new menu with the specified label.
|
| 修飾子とタイプ | メソッドと説明 |
|---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Invoked when an action occurs.
|
java.awt.MenuItem |
add(java.awt.MenuItem mi)
Adds the specified menu item to this menu.
|
void |
add(java.lang.String label)
Adds a checkbox item with the specified label to this menu.
|
void |
add(java.lang.String label,
java.lang.String command)
Adds a checkbox item with the specified label and command to this menu.
|
void |
add(java.lang.String label,
java.lang.String command,
boolean state)
Adds a checkbox item with the specified label, command, and state
to this menu.
|
void |
addSeparator()
Adds a separator line, or a hypen, to the menu at the current position.
|
java.lang.String |
getSelectedCommand()
Returns the selected command or null.
|
void |
insert(java.awt.MenuItem mi,
int index)
Inserts a menu item into this menu at the specified position.
|
void |
itemStateChanged(java.awt.event.ItemEvent e)
Invoked when an item's state has been changed.
|
static void |
main(java.lang.String[] args)
Executes the examples.
|
protected void |
notifyActionListeners(java.lang.String command)
Notifies the action event to the action listeners.
|
void |
remove(int index)
Removes the menu item at the specified index from this menu.
|
void |
select(java.lang.String command)
Selects the checkbox menu item which has the specified command.
|
addNotify, countItems, getAccessibleContext, getItem, getItemCount, insert, insertSeparator, isTearOff, paramString, remove, removeAll, removeNotifyaddActionListener, deleteShortcut, disable, disableEvents, enable, enable, enableEvents, getActionCommand, getActionListeners, getLabel, getListeners, getShortcut, isEnabled, processActionEvent, processEvent, removeActionListener, setActionCommand, setEnabled, setLabel, setShortcutdispatchEvent, getFont, getName, getParent, getPeer, getTreeLock, postEvent, setFont, setName, toStringpublic SelectionMenu()
public SelectionMenu(java.lang.String label)
label - the menu's label in the menu bar, or in another menu of
which this menu is a submenu.public SelectionMenu(java.lang.String label,
boolean tearOff)
tearOff is true, the menu can be torn off.label - the menu's label in the menu bar, or in another menu
of which this menu is a submenu.tearOff - if true, the menu is a tear-off menu.public void add(java.lang.String label)
add クラス内 java.awt.Menulabel - the text on the checkbox item.public void add(java.lang.String label,
java.lang.String command)
label - the text on the checkbox item.command - the action command on the checkbox item.public void add(java.lang.String label,
java.lang.String command,
boolean state)
label - the text on the checkbox item.command - the action command on the checkbox item.state - the initial state of the checkbox menu item.public void addSeparator()
addSeparator クラス内 java.awt.Menupublic java.awt.MenuItem add(java.awt.MenuItem mi)
add クラス内 java.awt.Menumi - the menu item to be added.java.lang.IllegalArgumentException - if the item is not a
CheckboxMenuItem or SelectionMenu.public void insert(java.awt.MenuItem mi,
int index)
insert クラス内 java.awt.Menumi - the menu item to be inserted.index - the position at which the menu item should be inserted.java.lang.IllegalArgumentException - if the item is not a
CheckboxMenuItem or SelectionMenu.public void remove(int index)
remove クラス内 java.awt.Menuindex - the position of the item to be removed.public java.lang.String getSelectedCommand()
public void select(java.lang.String command)
command - the command of the checkbox menu item to select.public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed インタフェース内 java.awt.event.ActionListenerActionListenerpublic void itemStateChanged(java.awt.event.ItemEvent e)
itemStateChanged インタフェース内 java.awt.event.ItemListenerItemListenerprotected void notifyActionListeners(java.lang.String command)
public static void main(java.lang.String[] args)