org.jscience.architecture.traffic.util
Class CheckMenu

java.lang.Object
  extended by java.awt.MenuComponent
      extended by java.awt.MenuItem
          extended by java.awt.Menu
              extended by org.jscience.architecture.traffic.util.CheckMenu
All Implemented Interfaces:
java.awt.ItemSelectable, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible
Direct Known Subclasses:
SimMenuBar.DPMenu, SimMenuBar.SpeedMenu

public class CheckMenu
extends java.awt.Menu
implements java.awt.ItemSelectable

This class is used to construct menus containing only CheckboxMenuItems

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Menu
java.awt.Menu.AccessibleAWTMenu
 
Nested classes/interfaces inherited from class java.awt.MenuItem
java.awt.MenuItem.AccessibleAWTMenuItem
 
Nested classes/interfaces inherited from class java.awt.MenuComponent
java.awt.MenuComponent.AccessibleAWTMenuComponent
 
Constructor Summary
CheckMenu(java.lang.String name, java.lang.String[] items)
          Creates a new CheckMenu.
CheckMenu(java.lang.String name, java.lang.String[] items, boolean allowmul)
          Creates a new CheckMenu.
 
Method Summary
 void addItemListener(java.awt.event.ItemListener il)
          Adds given item listener
 void deselect(java.awt.CheckboxMenuItem cmi)
          Deselects given item.
 void deselect(int i)
          Deselects the item with given index.
 void deselectAll()
          Deselects all items.
 int getIndex(java.awt.CheckboxMenuItem cmi)
          Returns the index of the given item.
 java.awt.CheckboxMenuItem[] getItems()
          Returns an array of all CheckboxMenuItems in this Checkmenu
 int getSelectedIndex()
          Returns the index of the currently selected item.
 java.awt.CheckboxMenuItem getSelectedItem()
          Returns the currently selected item.
 java.lang.Object[] getSelectedObjects()
          Returns an array of the objects currently selected
 void removeItemListener(java.awt.event.ItemListener il)
          Removes given item listener
 void select(java.awt.CheckboxMenuItem cmi)
          Selects the given item.
 void select(int i)
          Selects the item with given index.
 
Methods inherited from class java.awt.Menu
add, add, addNotify, addSeparator, countItems, getAccessibleContext, getItem, getItemCount, insert, insert, insertSeparator, isTearOff, paramString, remove, remove, removeAll, removeNotify
 
Methods inherited from class java.awt.MenuItem
addActionListener, deleteShortcut, disable, disableEvents, enable, enable, enableEvents, getActionCommand, getActionListeners, getLabel, getListeners, getShortcut, isEnabled, processActionEvent, processEvent, removeActionListener, setActionCommand, setEnabled, setLabel, setShortcut
 
Methods inherited from class java.awt.MenuComponent
dispatchEvent, getFont, getName, getParent, getPeer, getTreeLock, postEvent, setFont, setName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Constructor Detail

CheckMenu

public CheckMenu(java.lang.String name,
                 java.lang.String[] items)
Creates a new CheckMenu. The new menu does not allow multiple selections.

Parameters:
name - The name of the menu
items - The CheckboxMenuItems that are added to this menu

CheckMenu

public CheckMenu(java.lang.String name,
                 java.lang.String[] items,
                 boolean allowmul)
Creates a new CheckMenu.

Parameters:
name - The name of the new menu
items - The CheckboxMenuItems that are added to this menu
allowmul - Allows multiple selections if true
Method Detail

addItemListener

public void addItemListener(java.awt.event.ItemListener il)
Adds given item listener

Specified by:
addItemListener in interface java.awt.ItemSelectable
Parameters:
il - DOCUMENT ME!

removeItemListener

public void removeItemListener(java.awt.event.ItemListener il)
Removes given item listener

Specified by:
removeItemListener in interface java.awt.ItemSelectable
Parameters:
il - DOCUMENT ME!

getSelectedObjects

public java.lang.Object[] getSelectedObjects()
Returns an array of the objects currently selected

Specified by:
getSelectedObjects in interface java.awt.ItemSelectable
Returns:
DOCUMENT ME!

getItems

public java.awt.CheckboxMenuItem[] getItems()
Returns an array of all CheckboxMenuItems in this Checkmenu

Returns:
DOCUMENT ME!

deselectAll

public void deselectAll()
Deselects all items. This will send an itemStateChanged message to all listeners


deselect

public void deselect(java.awt.CheckboxMenuItem cmi)
Deselects given item. This will send an itemStateChanged message to all listeners

Parameters:
cmi - DOCUMENT ME!

deselect

public void deselect(int i)
Deselects the item with given index. This will send an itemStateChanged message to all listeners

Parameters:
i - DOCUMENT ME!

select

public void select(java.awt.CheckboxMenuItem cmi)
Selects the given item. This will send an itemStateChanged message to all listeners

Parameters:
cmi - DOCUMENT ME!

select

public void select(int i)
Selects the item with given index. This will send an itemStateChanged message to all listeners

Parameters:
i - DOCUMENT ME!

getIndex

public int getIndex(java.awt.CheckboxMenuItem cmi)
Returns the index of the given item. Returns -1 if the item is not part of this menu.

Parameters:
cmi - DOCUMENT ME!
Returns:
DOCUMENT ME!

getSelectedIndex

public int getSelectedIndex()
Returns the index of the currently selected item. Returns -1 if no item is selected, or if this is a multiple selections menu

Returns:
DOCUMENT ME!

getSelectedItem

public java.awt.CheckboxMenuItem getSelectedItem()
Returns the currently selected item. Returns null if no item is selected, or if this is a multiple selections menu

Returns:
DOCUMENT ME!