| Contents | Package | Class | Tree | Deprecated | Index | Help | Java 1.2 Beta 3 | ||
| PREV | NEXT | SHOW LISTS | HIDE LISTS | ||
java.lang.Object
|
+----java.awt.MenuComponent
|
+----java.awt.MenuItem
|
+----java.awt.CheckboxMenuItem
The following picture depicts a menu which contains an instance
of CheckBoxMenuItem:
The item labeled Check shows a check box menu item
in its "off" state.
When a check box menu item is selected, AWT sends an item event to
the item. Since the event is an instance of ItemEvent,
the processEvent method examines the event and passes
it along to processItemEvent. The latter method redirects
the event to any ItemListener objects that have
registered an interest in item events generated by this menu item.
| Constructor Summary | |
| CheckboxMenuItem()
|
|
| CheckboxMenuItem(String label)
|
|
| CheckboxMenuItem(String label,
boolean state)
|
|
| Method Summary | |
| void | addItemListener(ItemListener l)
|
| void | addNotify()
|
| Object[] | getSelectedObjects()
|
| boolean | getState()
|
| String | paramString()
|
| void | processEvent(AWTEvent e)
|
| void | processItemEvent(ItemEvent e)
ItemListener objects.
|
| void | removeItemListener(ItemListener l)
|
| void | setState(boolean b)
|
| Methods inherited from class java.awt.MenuItem |
| addActionListener, addNotify, deleteShortcut, disable, disableEvents, enable, enable, enableEvents, getActionCommand, getLabel, getShortcut, isEnabled, paramString, processActionEvent, processEvent, removeActionListener, setActionCommand, setEnabled, setLabel, setShortcut |
| Methods inherited from class java.awt.MenuComponent |
| dispatchEvent, getFont, getName, getParent, getPeer, paramString, postEvent, processEvent, removeNotify, setFont, setName, toString |
| Methods inherited from class java.lang.Object |
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public CheckboxMenuItem()
public CheckboxMenuItem(String label)
label
- a string label for the check box menu item,
or null for an unlabeled menu item.
public CheckboxMenuItem(String label,
boolean state)
label
- the button label.
state
- the initial state of the menu item, where
true indicates "on" and
false indicates "off."
| Method Detail |
public void addNotify()
public boolean getState()
true indicates "on" and
false indicates "off."public void setState(boolean b)
true indicates "on" while
false indicates "off."
b
- the boolean state of this
check box menu item.
public Object[] getSelectedObjects()
public void addItemListener(ItemListener l)
l
- the item listener.
public void removeItemListener(ItemListener l)
l
- the item listener.
protected void processEvent(AWTEvent e)
ItemEvent,
this method invokes the processItemEvent method.
If the event is not an item event,
it invokes processEvent on the superclass.
Check box menu items currently support only item events.
e
- the event
protected void processItemEvent(ItemEvent e)
ItemListener objects.
This method is not called unless item events are enabled for this menu item. Item events are enabled when one of the following occurs:
ItemListener object is registered
via addItemListener.
enableEvents.
e
- the item event.
public String paramString()
| Contents | Package | Class | Tree | Deprecated | Index | Help | Java 1.2 Beta 3 | ||
| PREV | NEXT | SHOW LISTS | HIDE LISTS | ||