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 CheckboxMenuItems.

Version:
20 Jun 1998
Author:
Kazuki YASUMATSU

Constructor Index

 o SelectionMenu()
Constructs a new menu with an empty label.
 o SelectionMenu(String)
Constructs a new menu with the specified label.
 o SelectionMenu(String, boolean)
Constructs a new menu with the specified label.

Method Index

 o actionPerformed(ActionEvent)
Invoked when an action occurs.
 o add(MenuItem)
Adds the specified menu item to this menu.
 o add(String)
Adds a checkbox item with the specified label to this menu.
 o add(String, String)
Adds a checkbox item with the specified label and command to this menu.
 o add(String, String, boolean)
Adds a checkbox item with the specified label, command, and state to this menu.
 o addSeparator()
Adds a separator line, or a hypen, to the menu at the current position.
 o getSelectedCommand()
Returns the selected command or null.
 o insert(MenuItem, int)
Inserts a menu item into this menu at the specified position.
 o itemStateChanged(ItemEvent)
Invoked when an item's state has been changed.
 o main(String[])
Executes the examples.
 o remove(int)
Removes the menu item at the specified index from this menu.
 o select(String)
Selects the checkbox menu item which has the specified command.

Constructors

 o SelectionMenu
 public SelectionMenu()
Constructs a new menu with an empty label. This menu is not a tear-off menu.

 o 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.
 o 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.

Methods

 o 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
 o 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.
 o 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.
 o addSeparator
 public void addSeparator()
Adds a separator line, or a hypen, to the menu at the current position.

Overrides:
addSeparator in class Menu
 o 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
 o 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
 o 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
 o getSelectedCommand
 public String getSelectedCommand()
Returns the selected command or null.

 o 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.
 o actionPerformed
 public void actionPerformed(ActionEvent e)
Invoked when an action occurs.

See Also:
ActionListener
 o itemStateChanged
 public void itemStateChanged(ItemEvent e)
Invoked when an item's state has been changed.

See Also:
ItemListener
 o main
 public static void main(String args[])
Executes the examples.


All Packages  Class Hierarchy  This Package  Previous  Next  Index