public class CheckboxMenuItem extends MenuItem implements ItemSelectable, Accessible
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.
ItemEvent
,
ItemListener
,
Serialized FormModifier and Type | Class and Description |
---|---|
protected class |
CheckboxMenuItem.AccessibleAWTCheckboxMenuItem
Inner class of CheckboxMenuItem used to provide default support for
accessibility.
|
MenuItem.AccessibleAWTMenuItem
MenuComponent.AccessibleAWTMenuComponent
Constructor and Description |
---|
CheckboxMenuItem()
Create a check box menu item with an empty label.
|
CheckboxMenuItem(String label)
Create a check box menu item with the specified label.
|
CheckboxMenuItem(String label,
boolean state)
Create a check box menu item with the specified label and state.
|
Modifier and Type | Method and Description |
---|---|
void |
addItemListener(ItemListener l)
Adds the specified item listener to receive item events from
this check box menu item.
|
void |
addNotify()
Creates the peer of the checkbox item.
|
AccessibleContext |
getAccessibleContext()
Gets the AccessibleContext associated with this CheckboxMenuItem.
|
ItemListener[] |
getItemListeners()
Returns an array of all the item listeners
registered on this checkbox menuitem.
|
<T extends EventListener> |
getListeners(Class<T> listenerType)
Returns an array of all the objects currently registered
as
FooListener s
upon this CheckboxMenuItem . |
Object[] |
getSelectedObjects()
Returns the an array (length 1) containing the checkbox menu item
label or null if the checkbox is not selected.
|
boolean |
getState()
Determines whether the state of this check box menu item
is "on" or "off."
|
String |
paramString()
Returns a string representing the state of this
CheckBoxMenuItem . |
protected void |
|