All Packages Class Hierarchy This Package Previous Next Index
Class jp.kyasu.editor.SelectionMenu
java.lang.Object
|
+----java.awt.MenuComponent
|
+----java.awt.MenuItem
|
+----java.awt.Menu
|
+----jp.kyasu.editor.SelectionMenu
- public class SelectionMenu
- extends Menu
- implements ActionListener, ItemListener
A SelectionMenu
object is a pull-down menu component that is
deployed from a menu bar. It can select one of the
CheckboxMenuItem
s.
- Version:
- 20 Jun 1998
- Author:
- Kazuki YASUMATSU
-
SelectionMenu()
- Constructs a new menu with an empty label.
-
SelectionMenu(String)
- Constructs a new menu with the specified label.
-
SelectionMenu(String, boolean)
- Constructs a new menu with the specified label.
-
actionPerformed(ActionEvent)
- Invoked when an action occurs.
-
add(MenuItem)
- Adds the specified menu item to this menu.
-
add(String)
- Adds a checkbox item with the specified label to this menu.
-
add(String, String)
- Adds a checkbox item with the specified label and command to this menu.
-
add(String, String, boolean)
- Adds a checkbox item with the specified label, command, and state
to this menu.
-
addSeparator()
- Adds a separator line, or a hypen, to the menu at the current position.
-
getSelectedCommand()
- Returns the selected command or null.
-
insert(MenuItem, int)
- Inserts a menu item into this menu at the specified position.
-
itemStateChanged(ItemEvent)
- Invoked when an item's state has been changed.
-
main(String[])
- Executes the examples.
-
remove(int)
- Removes the menu item at the specified index from this menu.
-
select(String)
- Selects the checkbox menu item which has the specified command.
SelectionMenu
public SelectionMenu()
- Constructs a new menu with an empty label. This menu is not a
tear-off menu.
SelectionMenu
public SelectionMenu(String label)
- Constructs a new menu with the specified label. This menu is not
a tear-off menu.
- Parameters:
- label - the menu's label in the menu bar, or in another menu of
which this menu is a submenu.
SelectionMenu
public SelectionMenu(String label,
boolean tearOff)
- Constructs a new menu with the specified label. If the value of
tearOff
is true
, the menu can be torn off.
- Parameters:
- 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.
add
public void add(String label)
- Adds a checkbox item with the specified label to this menu.
- Parameters:
- label - the text on the checkbox item.
- Overrides:
- add in class Menu
add
public void add(String label,
String command)
- Adds a checkbox item with the specified label and command to this menu.
- Parameters:
- label - the text on the checkbox item.
- command - the action command on the checkbox item.
add
public void add(String label,
String command,
boolean state)
- Adds a checkbox item with the specified label, command, and state
to this menu.
- Parameters:
- label - the text on the checkbox item.
- command - the action command on the checkbox item.
- state - the initial state of the checkbox menu item.
addSeparator
public void addSeparator()
- Adds a separator line, or a hypen, to the menu at the current position.
- Overrides:
- addSeparator in class Menu
add
public MenuItem add(MenuItem mi)
- Adds the specified menu item to this menu. If the menu item has
been part of another menu, remove it from that menu.
- Parameters:
- mi - the menu item to be added.
- Returns:
- the menu item added.
- Throws: IllegalArgumentException
- if the item is not a
CheckboxMenuItem or SelectionMenu.
- Overrides:
- add in class Menu
insert
public void insert(MenuItem mi,
int index)
- Inserts a menu item into this menu at the specified position.
- Parameters:
- mi - the menu item to be inserted.
- index - the position at which the menu item should be inserted.
- Throws: IllegalArgumentException
- if the item is not a
CheckboxMenuItem or SelectionMenu.
- Overrides:
- insert in class Menu
remove
public void remove(int index)
- Removes the menu item at the specified index from this menu.
- Parameters:
- index - the position of the item to be removed.
- Overrides:
- remove in class Menu
getSelectedCommand
public String getSelectedCommand()
- Returns the selected command or null.
select
public void select(String command)
- Selects the checkbox menu item which has the specified command.
- Parameters:
- command - the command of the checkbox menu item to select.
actionPerformed
public void actionPerformed(ActionEvent e)
- Invoked when an action occurs.
- See Also:
- ActionListener
itemStateChanged
public void itemStateChanged(ItemEvent e)
- Invoked when an item's state has been changed.
- See Also:
- ItemListener
main
public static void main(String args[])
- Executes the examples.
All Packages Class Hierarchy This Package Previous Next Index