APIdia Launch Partner
Top Description Inners Fields Constructors Methods
java.awt

public Class Checkbox

extends Component
implements ItemSelectable, Accessible
Class Inheritance
All Implemented Interfaces
javax.accessibility.Accessible, java.awt.ItemSelectable
Imports
java.awt.event.ItemEvent, .ItemListener, java.awt.peer.CheckboxPeer, java.io.IOException, .ObjectInputStream, .ObjectOutputStream, .Serial, java.util.EventListener, javax.accessibility.Accessible, .AccessibleAction, .AccessibleContext, .AccessibleRole, .AccessibleState, .AccessibleStateSet, .AccessibleValue

A check box is a graphical component that can be in either an "on" (true) or "off" (false) state. Clicking on a check box changes its state from "on" to "off," or from "off" to "on."

The following code example creates a set of check boxes in a grid layout:


setLayout(new GridLayout(3, 1));
add(new Checkbox("one", null, true));
add(new Checkbox("two"));
add(new Checkbox("three"));

This image depicts the check boxes and grid layout created by this code example:

The following context describes the
graphic.

The button labeled one is in the "on" state, and the other two are in the "off" state. In this example, which uses the GridLayout class, the states of the three check boxes are set independently.

Alternatively, several check boxes can be grouped together under the control of a single object, using the CheckboxGroup class. In a check box group, at most one button can be in the "on" state at any given time. Clicking on a check box to turn it on forces any other check box in the same group that is on into the "off" state.

Author
Sami Shaio
Since
1.0
See Also
java.awt.GridLayout, java.awt.CheckboxGroup

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected class
Checkbox.AccessibleAWTCheckbox

This class implements accessibility support for the Checkbox class.

Field Summary

Modifier and TypeField and Description
private static final String
private int
checkboxSerializedDataVersion

Serialized data version.

pack-priv CheckboxGroup
group

The check box group.

pack-priv transient ItemListener
pack-priv String
label

The label of the Checkbox.

private static int
private static final long
serialVersionUID

Hides java.awt.Component.serialVersionUID.

Use serialVersionUID from JDK 1.1 for interoperability.
pack-priv boolean
state

The state of the Checkbox.

Inherited from java.awt.Component:
accessibleContextactionListenerKadjustmentListenerKbackgroundbackgroundEraseDisabledBOTTOM_ALIGNMENTCENTER_ALIGNMENTcomponentListenercomponentListenerKcomponentOrientationcontainerListenerKcursordropTargetenabledeventCacheeventMaskfocusListenerfocusListenerKfocusTraversalKeysfontforegroundheighthierarchyBoundsListenerhierarchyBoundsListenerKhierarchyListenerhierarchyListenerKignoreRepaintincRateinputMethodListenerinputMethodListenerKisIncisPackeditemListenerKkeyListenerkeyListenerKLEFT_ALIGNMENTlocaleLOCKmaxSizemaxSizeSetminSizeminSizeSetmouseListenermouseListenerKmouseMotionListenermouseMotionListenerKmouseWheelListenermouseWheelListenerKnewEventsOnlyownedWindowKparentpeerpeerFontpopupsprefSizeprefSizeSetRIGHT_ALIGNMENTtextListenerKTOP_ALIGNMENTvisiblewidthwindowFocusListenerKwindowListenerKwindowStateListenerKxy

Constructor Summary

AccessConstructor and Description
public
Checkbox()

Creates a check box with an empty string for its label.

public
Checkbox(String
a string label for this check box, or null for no label.
label
)

Creates a check box with the specified label.

public
Checkbox(String
a string label for this check box, or null for no label
label
,
boolean
the initial state of this check box
state
)

Creates a check box with the specified label and sets the specified state.

public
Checkbox(String
a string label for this check box, or null for no label.
label
,
boolean
the initial state of this check box.
state
,
CheckboxGroup
a check box group for this check box, or null for no group.
group
)

Constructs a Checkbox with the specified label, set to the specified state, and in the specified check box group.

public
Checkbox(String
a string label for this check box, or null for no label.
label
,
CheckboxGroup
a check box group for this check box, or null for no group.
group
,
boolean
the initial state of this check box.
state
)

Creates a check box with the specified label, in the specified check box group, and set to the specified state.

Method Summary

Modifier and TypeMethod and Description
public synchronized void
addItemListener(ItemListener
the item listener
l
)

Implements java.awt.ItemSelectable.addItemListener.

Adds the specified item listener to receive item events from this check box.

public void
addNotify()

Overrides java.awt.Component.addNotify.

Creates the peer of the Checkbox.

pack-priv String

Returns:

a name for this component
constructComponentName
()

Overrides java.awt.Component.constructComponentName.

Constructs a name for this component.

pack-priv boolean
public AccessibleContext

Returns:

an AccessibleAWTCheckbox that serves as the AccessibleContext of this Checkbox
getAccessibleContext
()

Overrides java.awt.Component.getAccessibleContext.

Implements javax.accessibility.Accessible.getAccessibleContext.

Gets the AccessibleContext associated with this Checkbox.

public CheckboxGroup

Returns:

this check box's group, or null if the check box is not part of a check box group.
getCheckboxGroup
()

Determines this check box's group.

public synchronized ItemListener[]

Returns:

all of this checkbox's ItemListeners or an empty array if no item listeners are currently registered
getItemListeners
()

Returns an array of all the item listeners registered on this checkbox.

public String

Returns:

the label of this check box, or null if this check box has no label.
getLabel
()

Gets the label of this check box.

public <T extends EventListener> T[]

Returns:

an array of all objects registered as FooListeners on this checkbox, or an empty array if no such listeners have been added
getListeners
(Class<T>
the type of listeners requested; this parameter should specify an interface that descends from java.util.EventListener
listenerType
)

Overrides java.awt.Component.getListeners.

Returns an array of all the objects currently registered as FooListeners upon this Checkbox.

public Object[]
getSelectedObjects()

Implements java.awt.ItemSelectable.getSelectedObjects.

Returns an array (length 1) containing the checkbox label or null if the checkbox is not selected.

public boolean

Returns:

the state of this check box, as a boolean value
getState
()

Determines whether this check box is in the "on" or "off" state.

private static native void
initIDs()

Hides java.awt.Component.initIDs.

Initialize JNI field and method ids

protected String

Returns:

the parameter string of this check box
paramString
()

Overrides java.awt.Component.paramString.

Returns a string representing the state of this Checkbox.

protected void
processEvent(AWTEvent
the event
e
)

Overrides java.awt.Component.processEvent.

Processes events on this check box.

protected void
processItemEvent(ItemEvent
the item event
e
)

Processes item events occurring on this check box by dispatching them to any registered ItemListener objects.

private void
readObject(ObjectInputStream
the ObjectInputStream to read
s
)

Hides java.awt.Component.readObject.

Reads the ObjectInputStream and if it isn't null adds a listener to receive item events fired by the Checkbox.

public synchronized void
removeItemListener(ItemListener
the item listener
l
)

Implements java.awt.ItemSelectable.removeItemListener.

Removes the specified item listener so that the item listener no longer receives item events from this check box.

public void
setCheckboxGroup(CheckboxGroup
the new check box group, or null to remove this check box from any check box group
g
)

Sets this check box's group to the specified check box group.

public void
setLabel(String
a string to set as the new label, or null for no label.
label
)

Sets this check box's label to be the string argument.

public void
setState(boolean
the boolean state of the check box
state
)

Sets the state of this check box to the specified state.

pack-priv void
setStateInternal(boolean state)

Helper function for setState and CheckboxGroup.setSelectedCheckbox Should remain package-private.

private void
writeObject(ObjectOutputStream
the ObjectOutputStream to write
s
)

Hides java.awt.Component.writeObject.

Writes default serializable fields to stream.

Inherited from java.awt.Component:
actionaddaddComponentListeneraddFocusListeneraddHierarchyBoundsListeneraddHierarchyListeneraddInputMethodListeneraddKeyListeneraddMouseListeneraddMouseMotionListeneraddMouseWheelListeneraddPropertyChangeListeneraddPropertyChangeListeneradjustListeningChildrenOnParentapplyComponentOrientationapplyCompoundShapeapplyCurrentShapeareBoundsValidareFocusTraversalKeysSetareInputMethodsEnabledautoProcessMouseWheelboundscanBeFocusOwnercanBeFocusOwnerRecursivelycheckGDcheckImagecheckImagecheckTreeLockclearCurrentFocusCycleRootOnHideclearMostRecentFocusOwnerOnHidecoalesceEventscontainscontainscontainsFocuscountHierarchyMemberscreateBufferStrategycreateBufferStrategycreateHierarchyEventscreateImagecreateImagecreateVolatileImagecreateVolatileImagedeliverEventdisabledisableEventsdispatchEventdispatchEventImpldispatchMouseWheelToAncestordoLayoutenableenableenableEventsenableInputMethodseventTypeEnabledfindUnderMouseInWindowfirePropertyChangefirePropertyChangefirePropertyChangefirePropertyChangefirePropertyChangefirePropertyChangefirePropertyChangefirePropertyChangefirePropertyChangegetAccessibleIndexInParentgetAccessibleStateSetgetAlignmentXgetAlignmentYgetBackBuffergetBackgroundgetBaselinegetBaselineResizeBehaviorgetBoundsgetBoundsgetBoundsOpgetBufferStrategygetColorModelgetComponentAtgetComponentAtgetComponentFactorygetComponentListenersgetComponentOrientationgetContainergetContainingWindowgetCursorgetCursor_NoClientCodegetDropTargetgetFocusCycleRootAncestorgetFocusListenersgetFocusTraversalKeysgetFocusTraversalKeys_NoIDCheckgetFocusTraversalKeysEnabledgetFontgetFont_NoClientCodegetFontMetricsgetForegroundgetGraphicsgetGraphics_NoClientCodegetGraphicsConfigurationgetGraphicsConfiguration_NoClientCodegetHeightgetHierarchyBoundsListenersgetHierarchyListenersgetHWPeerAboveMegetIgnoreRepaintgetInputContextgetInputMethodListenersgetInputMethodRequestsgetKeyListenersgetLocalegetLocationgetLocationgetLocationOnScreengetLocationOnScreen_NoTreeLockgetLocationOnWindowgetMaximumSizegetMinimumSizegetMouseListenersgetMouseMotionListenersgetMousePositiongetMouseWheelListenersgetNamegetNativeContainergetNextFocusCandidategetNormalShapegetObjectLockgetOpaqueShapegetParentgetParent_NoClientCodegetPreferredSizegetPropertyChangeListenersgetPropertyChangeListenersgetSiblingIndexAbovegetSiblingIndexBelowgetSizegetSizegetToolkitgetToolkitImplgetTraversalRootgetTreeLockgetWidthgetXgetYgotFocushandleEventhasFocushideimageUpdateinitializeFocusTraversalKeysinsideinvalidateinvalidateIfValidinvalidateParentisAutoFocusTransferOnDisposalisBackgroundSetisCoalescingEnabledisCursorSetisDisplayableisDoubleBufferedisEnabledisEnabledImplisFocusableisFocusCycleRootisFocusOwnerisFocusTraversableisFocusTraversableOverriddenisFontSetisForegroundSetisInstanceOfisLightweightisMaximumSizeSetisMinimumSizeSetisMixingNeededisNonOpaqueForMixingisOpaqueisPreferredSizeSetisRecursivelyVisibleisSameOrAncestorOfisShowingisValidisVisibleisVisible_NoClientCodekeyDownkeyUplayoutlightweightPaintlightweightPrintlistlistlistlistlistlocatelocationlostFocusminimumSizemixOnHidingmixOnReshapingmixOnShowingmixOnValidatingmixOnZOrderChangingmouseDownmouseDragmouseEntermouseExitmouseMovemouseUpmovenextFocusnumListeningpaintpaintAllpaintHeavyweightComponentspointRelativeToComponentpostEventpostsOldMouseEventspreferredSizeprepareImageprepareImageprintprintAllprintHeavyweightComponentsprocessComponentEventprocessFocusEventprocessHierarchyBoundsEventprocessHierarchyEventprocessInputMethodEventprocessKeyEventprocessMouseEventprocessMouseMotionEventprocessMouseWheelEventrelocateComponentremoveremoveComponentListenerremoveFocusListenerremoveHierarchyBoundsListenerremoveHierarchyListenerremoveInputMethodListenerremoveKeyListenerremoveMouseListenerremoveMouseMotionListenerremoveMouseWheelListenerremoveNotifyremovePropertyChangeListenerremovePropertyChangeListenerrepaintrepaintrepaintrepaintrequestFocusrequestFocusrequestFocusrequestFocusrequestFocusHelperrequestFocusHelperrequestFocusInWindowrequestFocusInWindowrequestFocusInWindowrequestFocusInWindowreshaperesizeresizerevalidaterevalidateSynchronouslysetAutoFocusTransferOnDisposalsetBackgroundsetBoundssetBoundssetBoundsOpsetComponentOrientationsetCursorsetDropTargetsetEnabledsetFocusablesetFocusTraversalKeyssetFocusTraversalKeys_NoIDChecksetFocusTraversalKeysEnabledsetFontsetForegroundsetGraphicsConfigurationsetIgnoreRepaintsetLocalesetLocationsetLocationsetMaximumSizesetMinimumSizesetMixingCutoutShapesetNamesetPreferredSizesetRequestFocusControllersetSizesetSizesetVisibleshowshowsizesubtractAndApplyShapesubtractAndApplyShapeBelowMetoStringtransferFocustransferFocustransferFocusBackwardtransferFocusBackwardtransferFocusUpCycleupdateupdateChildGraphicsDataupdateCursorImmediatelyupdateGraphicsDataupdateZOrdervalidate

Field Detail

baseback to summary
private static final String base
checkboxSerializedDataVersionback to summary
private int checkboxSerializedDataVersion

Serialized data version.

groupback to summary
pack-priv CheckboxGroup group

The check box group. This field can be null indicating that the checkbox is not a group checkbox.

See Also
getCheckboxGroup(), setCheckboxGroup(CheckboxGroup)
itemListenerback to summary
pack-priv transient ItemListener itemListener
labelback to summary
pack-priv String label

The label of the Checkbox. This field can be null.

See Also
getLabel(), setLabel(String)
nameCounterback to summary
private static int nameCounter
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.awt.Component.serialVersionUID.

Use serialVersionUID from JDK 1.1 for interoperability.

Annotations
@Serial
stateback to summary
pack-priv boolean state

The state of the Checkbox.

See Also
getState(), setState(boolean)

Constructor Detail

Checkboxback to summary
public Checkbox() throws HeadlessException

Creates a check box with an empty string for its label. The state of this check box is set to "off," and it is not part of any check box group.

Exceptions
HeadlessException:
if GraphicsEnvironment.isHeadless() returns true
See Also
java.awt.GraphicsEnvironment#isHeadless
Checkboxback to summary
public Checkbox(String label) throws HeadlessException

Creates a check box with the specified label. The state of this check box is set to "off," and it is not part of any check box group.

Parameters
label:String

a string label for this check box, or null for no label.

Exceptions
HeadlessException:
if GraphicsEnvironment.isHeadless returns true
See Also
java.awt.GraphicsEnvironment#isHeadless
Checkboxback to summary
public Checkbox(String label, boolean state) throws HeadlessException

Creates a check box with the specified label and sets the specified state. This check box is not part of any check box group.

Parameters
label:String

a string label for this check box, or null for no label

state:boolean

the initial state of this check box

Exceptions
HeadlessException:
if GraphicsEnvironment.isHeadless returns true
See Also
java.awt.GraphicsEnvironment#isHeadless
Checkboxback to summary
public Checkbox(String label, boolean state, CheckboxGroup group) throws HeadlessException

Constructs a Checkbox with the specified label, set to the specified state, and in the specified check box group.

Parameters
label:String

a string label for this check box, or null for no label.

state:boolean

the initial state of this check box.

group:CheckboxGroup

a check box group for this check box, or null for no group.

Exceptions
HeadlessException:
if GraphicsEnvironment.isHeadless returns true
Since
1.1
See Also
java.awt.GraphicsEnvironment#isHeadless
Checkboxback to summary
public Checkbox(String label, CheckboxGroup group, boolean state) throws HeadlessException

Creates a check box with the specified label, in the specified check box group, and set to the specified state.

Parameters
label:String

a string label for this check box, or null for no label.

group:CheckboxGroup

a check box group for this check box, or null for no group.

state:boolean

the initial state of this check box.

Exceptions
HeadlessException:
if GraphicsEnvironment.isHeadless returns true
Since
1.1
See Also
java.awt.GraphicsEnvironment#isHeadless

Method Detail

addItemListenerback to summary
public synchronized void addItemListener(ItemListener l)

Implements java.awt.ItemSelectable.addItemListener.

Adds the specified item listener to receive item events from this check box. Item events are sent to listeners in response to user input, but not in response to calls to setState(). If l is null, no exception is thrown and no action is performed.

Refer to AWT Threading Issues for details on AWT's threading model.

Parameters
l:ItemListener

the item listener

Since
1.1
See Also
removeItemListener, getItemListeners, setState, java.awt.event.ItemEvent, java.awt.event.ItemListener
addNotifyback to summary
public void addNotify()

Overrides java.awt.Component.addNotify.

Creates the peer of the Checkbox. The peer allows you to change the look of the Checkbox without changing its functionality.

See Also
java.awt.Component#getToolkit()
constructComponentNameback to summary
pack-priv String constructComponentName()

Overrides java.awt.Component.constructComponentName.

Constructs a name for this component. Called by getName when the name is null.

Returns:String

a name for this component

eventEnabledback to summary
pack-priv boolean eventEnabled(AWTEvent e)

Overrides java.awt.Component.eventEnabled.

getAccessibleContextback to summary
public AccessibleContext getAccessibleContext()

Overrides java.awt.Component.getAccessibleContext.

Implements javax.accessibility.Accessible.getAccessibleContext.

Gets the AccessibleContext associated with this Checkbox. For checkboxes, the AccessibleContext takes the form of an AccessibleAWTCheckbox. A new AccessibleAWTCheckbox is created if necessary.

Returns:AccessibleContext

an AccessibleAWTCheckbox that serves as the AccessibleContext of this Checkbox

Since
1.3
getCheckboxGroupback to summary
public CheckboxGroup getCheckboxGroup()

Determines this check box's group.

Returns:CheckboxGroup

this check box's group, or null if the check box is not part of a check box group.

See Also
setCheckboxGroup(CheckboxGroup)
getItemListenersback to summary
public synchronized ItemListener[] getItemListeners()

Returns an array of all the item listeners registered on this checkbox.

Returns:ItemListener[]

all of this checkbox's ItemListeners or an empty array if no item listeners are currently registered

Since
1.4
See Also
addItemListener, removeItemListener, java.awt.event.ItemEvent, java.awt.event.ItemListener
getLabelback to summary
public String getLabel()

Gets the label of this check box.

Returns:String

the label of this check box, or null if this check box has no label.

See Also
setLabel(String)
getListenersback to summary
public <T extends EventListener> T[] getListeners(Class<T> listenerType)

Overrides java.awt.Component.getListeners.

Returns an array of all the objects currently registered as FooListeners upon this Checkbox. FooListeners are registered using the addFooListener method.

You can specify the listenerType argument with a class literal, such as FooListener.class. For example, you can query a Checkbox c for its item listeners with the following code:

ItemListener[] ils = (ItemListener[])(c.getListeners(ItemListener.class));
If no such listeners exist, this method returns an empty array.
Parameters
listenerType:Class<T>

the type of listeners requested; this parameter should specify an interface that descends from java.util.EventListener

Returns:T[]

an array of all objects registered as FooListeners on this checkbox, or an empty array if no such listeners have been added

Exceptions
ClassCastException:
if listenerType doesn't specify a class or interface that implements java.util.EventListener
Since
1.3
See Also
getItemListeners
getSelectedObjectsback to summary
public Object[] getSelectedObjects()

Implements java.awt.ItemSelectable.getSelectedObjects.

Returns an array (length 1) containing the checkbox label or null if the checkbox is not selected.

See Also
ItemSelectable
getStateback to summary
public boolean getState()

Determines whether this check box is in the "on" or "off" state. The boolean value true indicates the "on" state, and false indicates the "off" state.

Returns:boolean

the state of this check box, as a boolean value

See Also
setState
initIDsback to summary
private static native void initIDs()

Hides java.awt.Component.initIDs.

Initialize JNI field and method ids

paramStringback to summary
protected String paramString()

Overrides java.awt.Component.paramString.

Returns a string representing the state of this Checkbox. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null.

Returns:String

the parameter string of this check box

processEventback to summary
protected void processEvent(AWTEvent e)

Overrides java.awt.Component.processEvent.

Processes events on this check box. If the event is an instance of ItemEvent, this method invokes the processItemEvent method. Otherwise, it calls its superclass's processEvent method.

Note that if the event parameter is null the behavior is unspecified and may result in an exception.

Parameters
e:AWTEvent

the event

Since
1.1
See Also
java.awt.event.ItemEvent, processItemEvent
processItemEventback to summary
protected void processItemEvent(ItemEvent e)

Processes item events occurring on this check box by dispatching them to any registered ItemListener objects.

This method is not called unless item events are enabled for this component. Item events are enabled when one of the following occurs:

  • An ItemListener object is registered via addItemListener.
  • Item events are enabled via enableEvents.

Note that if the event parameter is null the behavior is unspecified and may result in an exception.

Parameters
e:ItemEvent

the item event

Since
1.1
See Also
java.awt.event.ItemEvent, java.awt.event.ItemListener, addItemListener, java.awt.Component#enableEvents
readObjectback to summary
private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException, HeadlessException

Hides java.awt.Component.readObject.

Reads the ObjectInputStream and if it isn't null adds a listener to receive item events fired by the Checkbox. Unrecognized keys or values will be ignored.

Parameters
s:ObjectInputStream

the ObjectInputStream to read

Annotations
@Serial
Exceptions
ClassNotFoundException:
if the class of a serialized object could not be found
IOException:
if an I/O error occurs
HeadlessException:
if GraphicsEnvironment.isHeadless() returns true
See Also
removeItemListener(ItemListener), addItemListener(ItemListener), java.awt.GraphicsEnvironment#isHeadless, writeObject(ObjectOutputStream)
removeItemListenerback to summary
public synchronized void removeItemListener(ItemListener l)

Implements java.awt.ItemSelectable.removeItemListener.

Removes the specified item listener so that the item listener no longer receives item events from this check box. If l is null, no exception is thrown and no action is performed.

Refer to AWT Threading Issues for details on AWT's threading model.

Parameters
l:ItemListener

the item listener

Since
1.1
See Also
addItemListener, getItemListeners, java.awt.event.ItemEvent, java.awt.event.ItemListener
setCheckboxGroupback to summary
public void setCheckboxGroup(CheckboxGroup g)

Sets this check box's group to the specified check box group. If this check box is already in a different check box group, it is first taken out of that group.

If the state of this check box is true and the new group already has a check box selected, this check box's state is changed to false. If the state of this check box is true and the new group has no check box selected, this check box becomes the selected checkbox for the new group and its state is true.

Parameters
g:CheckboxGroup

the new check box group, or null to remove this check box from any check box group

See Also
getCheckboxGroup
setLabelback to summary
public void setLabel(String label)

Sets this check box's label to be the string argument.

Parameters
label:String

a string to set as the new label, or null for no label.

See Also
getLabel
setStateback to summary
public void setState(boolean state)

Sets the state of this check box to the specified state. The boolean value true indicates the "on" state, and false indicates the "off" state.

Note that this method should be primarily used to initialize the state of the checkbox. Programmatically setting the state of the checkbox will not trigger an ItemEvent. The only way to trigger an ItemEvent is by user interaction.

Parameters
state:boolean

the boolean state of the check box

See Also
getState
setStateInternalback to summary
pack-priv void setStateInternal(boolean state)

Helper function for setState and CheckboxGroup.setSelectedCheckbox Should remain package-private.

writeObjectback to summary
private void writeObject(ObjectOutputStream s) throws IOException

Hides java.awt.Component.writeObject.

Writes default serializable fields to stream. Writes a list of serializable ItemListeners as optional data. The non-serializable ItemListeners are detected and no attempt is made to serialize them.

Parameters
s:ObjectOutputStream

the ObjectOutputStream to write

Annotations
@Serial
Exceptions
IOException:
if an I/O error occurs
Serial data
null terminated sequence of 0 or more pairs; the pair consists of a String and an Object; the String indicates the type of object and is one of the following: itemListenerK indicating an ItemListener object
See Also
AWTEventMulticaster#save(ObjectOutputStream, String, EventListener), java.awt.Component#itemListenerK, readObject(ObjectInputStream)
java.awt back to summary

protected Class Checkbox.AccessibleAWTCheckbox

extends AccessibleAWTComponent
implements ItemListener, AccessibleAction, AccessibleValue
Class Inheritance
All Implemented Interfaces
javax.accessibility.AccessibleValue, javax.accessibility.AccessibleAction, java.awt.event.ItemListener, java.util.EventListener

This class implements accessibility support for the Checkbox class. It provides an implementation of the Java Accessibility API appropriate to checkbox user-interface elements.
Since
1.3

Field Summary

Modifier and TypeField and Description
private static final long
serialVersionUID

Hides java.awt.Component.AccessibleAWTComponent.serialVersionUID.

Use serialVersionUID from JDK 1.3 for interoperability.
Inherited from java.awt.Component.AccessibleAWTComponent:
accessibleAWTComponentHandleraccessibleAWTFocusHandler

Constructor Summary

AccessConstructor and Description
public
AccessibleAWTCheckbox()

Constructor for AccessibleAWTCheckbox

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the action was performed; else false.
doAccessibleAction
(int
zero-based index of actions
i
)

Implements javax.accessibility.AccessibleAction.doAccessibleAction.

Perform the specified Action on the object

public AccessibleAction

Returns:

this object
getAccessibleAction
()

Overrides javax.accessibility.AccessibleContext.getAccessibleAction.

Get the AccessibleAction associated with this object.

public int

Returns:

the number of Actions in this object
getAccessibleActionCount
()

Implements javax.accessibility.AccessibleAction.getAccessibleActionCount.

Returns the number of Actions available in this object.

public String
getAccessibleActionDescription(int
zero-based index of the actions
i
)

Implements javax.accessibility.AccessibleAction.getAccessibleActionDescription.

Return a description of the specified action of the object.

public AccessibleRole

Returns:

an instance of AccessibleRole describing the role of the object
getAccessibleRole
()

Overrides java.awt.Component.AccessibleAWTComponent.getAccessibleRole.

Get the role of this object.

public AccessibleStateSet

Returns:

an instance of AccessibleState containing the current state of the object
getAccessibleStateSet
()

Overrides java.awt.Component.AccessibleAWTComponent.getAccessibleStateSet.

Get the state set of this object.

public AccessibleValue

Returns:

this object
getAccessibleValue
()

Overrides javax.accessibility.AccessibleContext.getAccessibleValue.

Get the AccessibleValue associated with this object.

public Number

Returns:

value of the object
getCurrentAccessibleValue
()

Implements javax.accessibility.AccessibleValue.getCurrentAccessibleValue.

Get the value of this object as a Number.

public Number

Returns:

Maximum value of the object; null if this object does not have a maximum value
getMaximumAccessibleValue
()

Implements javax.accessibility.AccessibleValue.getMaximumAccessibleValue.

Get the maximum value of this object as a Number.

public Number

Returns:

Minimum value of the object; null if this object does not have a minimum value
getMinimumAccessibleValue
()

Implements javax.accessibility.AccessibleValue.getMinimumAccessibleValue.

Get the minimum value of this object as a Number.

public void
itemStateChanged(ItemEvent e)

Implements java.awt.event.ItemListener.itemStateChanged.

Fire accessible property change events when the state of the toggle button changes.

public boolean

Returns:

True if the value was set; else False
setCurrentAccessibleValue
(Number n)

Implements javax.accessibility.AccessibleValue.setCurrentAccessibleValue.

Set the value of this object as a Number.

Inherited from java.awt.Component.AccessibleAWTComponent:
addFocusListeneraddPropertyChangeListenercontainsgetAccessibleAtgetAccessibleChildgetAccessibleChildrenCountgetAccessibleComponentgetAccessibleDescriptiongetAccessibleIndexInParentgetAccessibleNamegetAccessibleParentgetBackgroundgetBoundsgetCursorgetFontgetFontMetricsgetForegroundgetLocalegetLocationgetLocationOnScreengetSizeisEnabledisFocusTraversableisShowingisVisibleremoveFocusListenerremovePropertyChangeListenerrequestFocussetBackgroundsetBoundssetCursorsetEnabledsetFontsetForegroundsetLocationsetSizesetVisible

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.awt.Component.AccessibleAWTComponent.serialVersionUID.

Use serialVersionUID from JDK 1.3 for interoperability.

Annotations
@Serial

Constructor Detail

AccessibleAWTCheckboxback to summary
public AccessibleAWTCheckbox()

Constructor for AccessibleAWTCheckbox

Method Detail

doAccessibleActionback to summary
public boolean doAccessibleAction(int i)

Implements javax.accessibility.AccessibleAction.doAccessibleAction.

Perform the specified Action on the object

Parameters
i:int

zero-based index of actions

Returns:boolean

true if the action was performed; else false.

getAccessibleActionback to summary
public AccessibleAction getAccessibleAction()

Overrides javax.accessibility.AccessibleContext.getAccessibleAction.

Get the AccessibleAction associated with this object. In the implementation of the Java Accessibility API for this class, return this object, which is responsible for implementing the AccessibleAction interface on behalf of itself.

Returns:AccessibleAction

this object

getAccessibleActionCountback to summary
public int getAccessibleActionCount()

Implements javax.accessibility.AccessibleAction.getAccessibleActionCount.

Returns the number of Actions available in this object. If there is more than one, the first one is the "default" action.

Returns:int

the number of Actions in this object

getAccessibleActionDescriptionback to summary
public String getAccessibleActionDescription(int i)

Implements javax.accessibility.AccessibleAction.getAccessibleActionDescription.

Return a description of the specified action of the object.

Parameters
i:int

zero-based index of the actions

getAccessibleRoleback to summary
public AccessibleRole getAccessibleRole()

Overrides java.awt.Component.AccessibleAWTComponent.getAccessibleRole.

Get the role of this object.

Returns:AccessibleRole

an instance of AccessibleRole describing the role of the object

See Also
AccessibleRole
getAccessibleStateSetback to summary
public AccessibleStateSet getAccessibleStateSet()

Overrides java.awt.Component.AccessibleAWTComponent.getAccessibleStateSet.

Get the state set of this object.

Returns:AccessibleStateSet

an instance of AccessibleState containing the current state of the object

See Also
AccessibleState
getAccessibleValueback to summary
public AccessibleValue getAccessibleValue()

Overrides javax.accessibility.AccessibleContext.getAccessibleValue.

Get the AccessibleValue associated with this object. In the implementation of the Java Accessibility API for this class, return this object, which is responsible for implementing the AccessibleValue interface on behalf of itself.

Returns:AccessibleValue

this object

getCurrentAccessibleValueback to summary
public Number getCurrentAccessibleValue()

Implements javax.accessibility.AccessibleValue.getCurrentAccessibleValue.

Get the value of this object as a Number. If the value has not been set, the return value will be null.

Returns:Number

value of the object

See Also
setCurrentAccessibleValue
getMaximumAccessibleValueback to summary
public Number getMaximumAccessibleValue()

Implements javax.accessibility.AccessibleValue.getMaximumAccessibleValue.

Get the maximum value of this object as a Number.

Returns:Number

Maximum value of the object; null if this object does not have a maximum value

See Also
getMinimumAccessibleValue
getMinimumAccessibleValueback to summary
public Number getMinimumAccessibleValue()

Implements javax.accessibility.AccessibleValue.getMinimumAccessibleValue.

Get the minimum value of this object as a Number.

Returns:Number

Minimum value of the object; null if this object does not have a minimum value

See Also
getMaximumAccessibleValue
itemStateChangedback to summary
public void itemStateChanged(ItemEvent e)

Implements java.awt.event.ItemListener.itemStateChanged.

Fire accessible property change events when the state of the toggle button changes.

setCurrentAccessibleValueback to summary
public boolean setCurrentAccessibleValue(Number n)

Implements javax.accessibility.AccessibleValue.setCurrentAccessibleValue.

Set the value of this object as a Number.

Returns:boolean

True if the value was set; else False

See Also
getCurrentAccessibleValue