java.awt
Class CheckboxMenuItem
java.lang.Object
|
+--java.awt.MenuComponent
|
+--java.awt.MenuItem
|
+--java.awt.CheckboxMenuItem
All Implemented Interfaces:
ItemSelectable, Serializable, Serializable
This class implements a menu item that has a checkbox on it indicating
the selected state of some option.
Authors:- Aaron M. Renn (arenn@urbanophile.com)
- Tom Tromey <tromey@redhat.com>
CheckboxMenuItem
public CheckboxMenuItem()
Initializes a new instance of CheckboxMenuItem
with no
label and an initial state of off.
Throws:
CheckboxMenuItem
public CheckboxMenuItem(java.lang.String label)
Initializes a new instance of CheckboxMenuItem
with the
specified label and an initial state of off.
Parameters:
Throws:
CheckboxMenuItem
public CheckboxMenuItem(java.lang.String label, boolean state)
Initializes a new instance of CheckboxMenuItem
with the
specified label and initial state.
Parameters:
Throws:
addItemListener
public synchronized void addItemListener(java.awt.event.ItemListener listener)
Adds the specified listener to the list of registered item listeners
for this object.
Parameters:
addNotify
public synchronized void addNotify()
Create's this object's native peer
getItemListeners
public ItemListener[] getItemListeners()
Returns an aray of all item listeners currently registered to this
CheckBoxMenuItem
.
getListeners
public EventListener[] getListeners(java.lang.Class listenerType)
Returns an array of all the objects currently registered as FooListeners
upon this CheckboxMenuItem
. FooListeners are registered using
the addFooListener method.
Parameters:
Throws:
ClassCastException
- If listenerType doesn't specify a class or
interface that implements java.util.EventListener.
getSelectedObjects
public Object[] getSelectedObjects()
Returns an array of length 1 with the menu item label for this object
if the state is on. Otherwise null
is returned.
getState
public boolean getState()
Returns the state of this menu item.
Returns:
- The state of this menu item.
paramString
public String paramString()
Returns a debugging string for this object.
Returns:
- A debugging string for this object.
processEvent
protected void processEvent(java.awt.AWTEvent event)
Processes the specified event by calling processItemEvent()
if it is an instance of ItemEvent
or calling the superclass
method otherwise.
Parameters:
processItemEvent
protected void processItemEvent(java.awt.event.ItemEvent event)
Processes the specified event by dispatching it to any registered listeners.
Parameters:
removeItemListener
public synchronized void removeItemListener(java.awt.event.ItemListener listener)
Removes the specified listener from the list of registered item
listeners for this object.
Parameters:
setState
public synchronized void setState(boolean state)
Sets the state of this menu item.
Parameters: