Top Description Inners Fields Constructors Methods
java.awt

public Class Button

extends Component
implements Accessible
Class Inheritance
All Implemented Interfaces
javax.accessibility.Accessible
Imports
java.awt.event.ActionEvent, .ActionListener, java.awt.peer.ButtonPeer, java.beans.BeanProperty, java.io.IOException, .ObjectInputStream, .ObjectOutputStream, .Serial, java.util.EventListener, javax.accessibility.Accessible, .AccessibleAction, .AccessibleContext, .AccessibleRole, .AccessibleValue

This class creates a labeled button. The application can cause some action to happen when the button is pushed. This image depicts three views of a "Quit" button as it appears under the Solaris operating system:

The following context describes the
graphic

The first view shows the button as it appears normally. The second view shows the button when it has input focus. Its outline is darkened to let the user know that it is an active object. The third view shows the button when the user clicks the mouse over the button, and thus requests that an action be performed.

The gesture of clicking on a button with the mouse is associated with one instance of ActionEvent, which is sent out when the mouse is both pressed and released over the button. If an application is interested in knowing when the button has been pressed but not released, as a separate gesture, it can specialize processMouseEvent, or it can register itself as a listener for mouse events by calling addMouseListener. Both of these methods are defined by Component, the abstract superclass of all components.

When a button is pressed and released, AWT sends an instance of ActionEvent to the button, by calling processEvent on the button. The button's processEvent method receives all events for the button; it passes an action event along by calling its own processActionEvent method. The latter method passes the action event on to any action listeners that have registered an interest in action events generated by this button.

If an application wants to perform some action based on a button being pressed and released, it should implement ActionListener and register the new listener to receive events from this button, by calling the button's addActionListener method. The application can make use of the button's action command as a messaging protocol.

Author
Sami Shaio
Since
1.0
See Also
java.awt.event.ActionEvent, java.awt.event.ActionListener, java.awt.Component#processMouseEvent, java.awt.Component#addMouseListener

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected class
Button.AccessibleAWTButton

This class implements accessibility support for the Button class.

Field Summary

Modifier and TypeField and Description
pack-priv String
actionCommand

The action to be performed once a button has been pressed.

pack-priv transient ActionListener
private static final String
private int
buttonSerializedDataVersion

Serialized data version.

pack-priv String
label

The button's label.

private static int
private static final long
serialVersionUID

Hides java.awt.Component.serialVersionUID.

Use serialVersionUID from JDK 1.1 for interoperability.
Inherited from java.awt.Component:
accessibleContextactionListenerKadjustmentListenerKappContextbackgroundbackgroundEraseDisabledBOTTOM_ALIGNMENTCENTER_ALIGNMENTcomponentListenercomponentListenerKcomponentOrientationcontainerListenerKcursordropTargetenabledeventCacheeventMaskfocusListenerfocusListenerKfocusTraversalKeysfontforegroundheighthierarchyBoundsListenerhierarchyBoundsListenerKhierarchyListenerhierarchyListenerKignoreRepaintincRateinputMethodListenerinputMethodListenerKisIncisPackeditemListenerKkeyListenerkeyListenerKLEFT_ALIGNMENTlocaleLOCKmaxSizemaxSizeSetminSizeminSizeSetmouseListenermouseListenerKmouseMotionListenermouseMotionListenerKmouseWheelListenermouseWheelListenerKnewEventsOnlyownedWindowKparentpeerpeerFontpopupsprefSizeprefSizeSetRIGHT_ALIGNMENTtextListenerKTOP_ALIGNMENTvisiblewidthwindowFocusListenerKwindowListenerKwindowStateListenerKxy

Constructor Summary

AccessConstructor and Description
public
Button()

Constructs a button with an empty string for its label.

public
Button(String
a string label for the button, or null for no label
label
)

Constructs a button with the specified label.

Method Summary

Modifier and TypeMethod and Description
public synchronized void
addActionListener(ActionListener
the action listener
l
)

Adds the specified action listener to receive action events from this button.

public void
addNotify()

Overrides java.awt.Component.addNotify.

Creates the peer of the button.
pack-priv String
constructComponentName()

Overrides java.awt.Component.constructComponentName.

Construct a name for this component.
pack-priv boolean
public AccessibleContext

Returns:

an AccessibleAWTButton that serves as the AccessibleContext of this Button
getAccessibleContext
()

Overrides java.awt.Component.getAccessibleContext.

Implements javax.accessibility.Accessible.getAccessibleContext.

Gets the AccessibleContext associated with this Button.
public String

Returns:

the action command name (or label) for this button
getActionCommand
()

Returns the command name of the action event fired by this button.

public synchronized ActionListener[]

Returns:

all of this button's ActionListeners or an empty array if no action listeners are currently registered
getActionListeners
()

Returns an array of all the action listeners registered on this button.

public String

Returns:

the button's label, or null if the button has no label.
getLabel
()

Gets the label of this button.

public <T extends EventListener> T[]

Returns:

an array of all objects registered as FooListeners on this button, 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 Button.
protected String

Returns:

the parameter string of this button
paramString
()

Overrides java.awt.Component.paramString.

Returns a string representing the state of this Button.
protected void
processActionEvent(ActionEvent
the action event
e
)

Processes action events occurring on this button by dispatching them to any registered ActionListener objects.

protected void
processEvent(AWTEvent
the event
e
)

Overrides java.awt.Component.processEvent.

Processes events on this button.
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 action events fired by the button.
public synchronized void
removeActionListener(ActionListener
the action listener
l
)

Removes the specified action listener so that it no longer receives action events from this button.

public void
setActionCommand(String
a string used to set the button's action command. If the string is null then the action command is set to match the label of the button.
command
)

Sets the command name for the action event fired by this button.

public void
setLabel(String
the new label, or null if the button has no label.
label
)

Sets the button's label to be the specified string.

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:
actionaddaddComponentListeneraddFocusListeneraddHierarchyBoundsListeneraddHierarchyListeneraddInputMethodListeneraddKeyListeneraddMouseListeneraddMouseMotionListeneraddMouseWheelListeneraddPropertyChangeListeneraddPropertyChangeListeneradjustListeningChildrenOnParentapplyComponentOrientationapplyCompoundShapeapplyCurrentShapeareBoundsValidareFocusTraversalKeysSetareInputMethodsEnabledautoProcessMouseWheelboundscanBeFocusOwnercanBeFocusOwnerRecursivelycheckGDcheckImagecheckImagecheckTreeLockclearCurrentFocusCycleRootOnHideclearMostRecentFocusOwnerOnHidecoalesceEventscontainscontainscontainsFocuscountHierarchyMemberscreateBufferStrategycreateBufferStrategycreateHierarchyEventscreateImagecreateImagecreateVolatileImagecreateVolatileImagedeliverEventdisabledisableEventsdispatchEventdispatchEventImpldispatchMouseWheelToAncestordoLayoutenableenableenableEventsenableInputMethodseventTypeEnabledfindUnderMouseInWindowfirePropertyChangefirePropertyChangefirePropertyChangefirePropertyChangefirePropertyChangefirePropertyChangefirePropertyChangefirePropertyChangefirePropertyChangegetAccessControlContextgetAccessibleIndexInParentgetAccessibleStateSetgetAlignmentXgetAlignmentYgetBackBuffergetBackgroundgetBaselinegetBaselineResizeBehaviorgetBoundsgetBoundsgetBoundsOpgetBufferStrategygetColorModelgetComponentAtgetComponentAtgetComponentFactorygetComponentListenersgetComponentOrientationgetContainergetContainingWindowgetCursorgetCursor_NoClientCodegetDropTargetgetFocusCycleRootAncestorgetFocusListenersgetFocusTraversalKeysgetFocusTraversalKeys_NoIDCheckgetFocusTraversalKeysEnabledgetFontgetFont_NoClientCodegetFontMetricsgetForegroundgetGraphicsgetGraphics_NoClientCodegetGraphicsConfigurationgetGraphicsConfiguration_NoClientCodegetHeightgetHierarchyBoundsListenersgetHierarchyListenersgetHWPeerAboveMegetIgnoreRepaintgetInputContextgetInputMethodListenersgetInputMethodRequestsgetKeyListenersgetLocalegetLocationgetLocationgetLocationOnScreengetLocationOnScreen_NoTreeLockgetLocationOnWindowgetMaximumSizegetMinimumSizegetMouseListenersgetMouseMotionListenersgetMousePositiongetMouseWheelListenersgetNamegetNativeContainergetNextFocusCandidategetNormalShapegetObjectLockgetOpaqueShapegetParentgetParent_NoClientCodegetPreferredSizegetPropertyChangeListenersgetPropertyChangeListenersgetSiblingIndexAbovegetSiblingIndexBelowgetSizegetSizegetToolkitgetToolkitImplgetTraversalRootgetTreeLockgetWidthgetXgetYgotFocushandleEventhasFocushideimageUpdateinitializeFocusTraversalKeysinsideinvalidateinvalidateIfValidinvalidateParentisAutoFocusTransferOnDisposalisBackgroundSetisCoalescingEnabledisCursorSetisDisplayableisDoubleBufferedisEnabledisEnabledImplisFocusableisFocusCycleRootisFocusOwnerisFocusTraversableisFocusTraversableOverriddenisFontSetisForegroundSetisInstanceOfisLightweightisMaximumSizeSetisMinimumSizeSetisMixingNeededisNonOpaqueForMixingisOpaqueisPreferredSizeSetisRecursivelyVisibleisSameOrAncestorOfisShowingisValidisVisibleisVisible_NoClientCodekeyDownkeyUplayoutlightweightPaintlightweightPrintlistlistlistlistlistlocatelocationlostFocusminimumSizemixOnHidingmixOnReshapingmixOnShowingmixOnValidatingmixOnZOrderChangingmouseDownmouseDragmouseEntermouseExitmouseMovemouseUpmovenextFocusnumListeningpaintpaintAllpaintHeavyweightComponentspointRelativeToComponentpostEventpostsOldMouseEventspreferredSizeprepareImageprepareImageprintprintAllprintHeavyweightComponentsprocessComponentEventprocessFocusEventprocessHierarchyBoundsEventprocessHierarchyEventprocessInputMethodEventprocessKeyEventprocessMouseEventprocessMouseMotionEventprocessMouseWheelEventrelocateComponentremoveremoveComponentListenerremoveFocusListenerremoveHierarchyBoundsListenerremoveHierarchyListenerremoveInputMethodListenerremoveKeyListenerremoveMouseListenerremoveMouseMotionListenerremoveMouseWheelListenerremoveNotifyremovePropertyChangeListenerremovePropertyChangeListenerrepaintrepaintrepaintrepaintrequestFocusrequestFocusrequestFocusrequestFocusrequestFocusHelperrequestFocusHelperrequestFocusInWindowrequestFocusInWindowrequestFocusInWindowrequestFocusInWindowreshaperesizeresizerevalidaterevalidateSynchronouslysetAutoFocusTransferOnDisposalsetBackgroundsetBoundssetBoundssetBoundsOpsetComponentOrientationsetCursorsetDropTargetsetEnabledsetFocusablesetFocusTraversalKeyssetFocusTraversalKeys_NoIDChecksetFocusTraversalKeysEnabledsetFontsetForegroundsetGraphicsConfigurationsetIgnoreRepaintsetLocalesetLocationsetLocationsetMaximumSizesetMinimumSizesetMixingCutoutShapesetNamesetPreferredSizesetRequestFocusControllersetSizesetSizesetVisibleshowshowsizesubtractAndApplyShapesubtractAndApplyShapeBelowMetoStringtransferFocustransferFocustransferFocusBackwardtransferFocusBackwardtransferFocusUpCycleupdateupdateChildGraphicsDataupdateCursorImmediatelyupdateGraphicsDataupdateZOrdervalidate

Field Detail

actionCommandback to summary
pack-priv String actionCommand

The action to be performed once a button has been pressed. This value may be null.

See Also
getActionCommand(), setActionCommand(String)
actionListenerback to summary
pack-priv transient ActionListener actionListener
baseback to summary
private static final String base
buttonSerializedDataVersionback to summary
private int buttonSerializedDataVersion

Serialized data version.

labelback to summary
pack-priv String label

The button's label. This value may 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

Constructor Detail

Buttonback to summary
public Button() throws HeadlessException

Constructs a button with an empty string for its label.

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

Constructs a button with the specified label.

Parameters
label:String

a string label for the button, or null for no label

Exceptions
HeadlessException:
if GraphicsEnvironment.isHeadless() returns true
See Also
java.awt.GraphicsEnvironment#isHeadless

Method Detail

addActionListenerback to summary
public synchronized void addActionListener(ActionListener l)

Adds the specified action listener to receive action events from this button. Action events occur when a user presses or releases the mouse over this button. 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:ActionListener

the action listener

Since
1.1
See Also
removeActionListener, getActionListeners, java.awt.event.ActionListener
addNotifyback to summary
public void addNotify()

Overrides java.awt.Component.addNotify.

Creates the peer of the button. The button's peer allows the application to change the look of the button without changing its functionality.

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

Overrides java.awt.Component.constructComponentName.

Construct a name for this component. Called by getName() when the name is null.

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 Button. For buttons, the AccessibleContext takes the form of an AccessibleAWTButton. A new AccessibleAWTButton instance is created if necessary.

Returns:AccessibleContext

an AccessibleAWTButton that serves as the AccessibleContext of this Button

Annotations
@BeanProperty
expert:true
description:The AccessibleContext associated with this Button.
Since
1.3
getActionCommandback to summary
public String getActionCommand()

Returns the command name of the action event fired by this button. If the command name is null (default) then this method returns the label of the button.

Returns:String

the action command name (or label) for this button

getActionListenersback to summary
public synchronized ActionListener[] getActionListeners()

Returns an array of all the action listeners registered on this button.

Returns:ActionListener[]

all of this button's ActionListeners or an empty array if no action listeners are currently registered

Since
1.4
See Also
addActionListener, removeActionListener, java.awt.event.ActionListener
getLabelback to summary
public String getLabel()

Gets the label of this button.

Returns:String

the button's label, or null if the button has no label.

See Also
java.awt.Button#setLabel
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 Button. 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 Button b for its action listeners with the following code:

ActionListener[] als = (ActionListener[])(b.getListeners(ActionListener.class));
If no such listeners exist, this method returns an empty array.
Parameters
<T>

Doc from java.awt.Component.getListeners. the type of the listeners

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 button, 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
getActionListeners
paramStringback to summary
protected String paramString()

Overrides java.awt.Component.paramString.

Returns a string representing the state of this Button. 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 button

processActionEventback to summary
protected void processActionEvent(ActionEvent e)

Processes action events occurring on this button by dispatching them to any registered ActionListener objects.

This method is not called unless action events are enabled for this button. Action events are enabled when one of the following occurs:

  • An ActionListener object is registered via addActionListener.
  • Action 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:ActionEvent

the action event

Since
1.1
See Also
java.awt.event.ActionListener, java.awt.Button#addActionListener, java.awt.Component#enableEvents
processEventback to summary
protected void processEvent(AWTEvent e)

Overrides java.awt.Component.processEvent.

Processes events on this button. If an event is an instance of ActionEvent, this method invokes the processActionEvent method. Otherwise, it invokes processEvent on the superclass.

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.ActionEvent, java.awt.Button#processActionEvent
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 action events fired by the button. 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
removeActionListener(ActionListener), addActionListener(ActionListener), java.awt.GraphicsEnvironment#isHeadless, writeObject(ObjectOutputStream)
removeActionListenerback to summary
public synchronized void removeActionListener(ActionListener l)

Removes the specified action listener so that it no longer receives action events from this button. Action events occur when a user presses or releases the mouse over this button. 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:ActionListener

the action listener

Since
1.1
See Also
addActionListener, getActionListeners, java.awt.event.ActionListener
setActionCommandback to summary
public void setActionCommand(String command)

Sets the command name for the action event fired by this button. By default this action command is set to match the label of the button.

Parameters
command:String

a string used to set the button's action command. If the string is null then the action command is set to match the label of the button.

Since
1.1
See Also
java.awt.event.ActionEvent
setLabelback to summary
public void setLabel(String label)

Sets the button's label to be the specified string.

Parameters
label:String

the new label, or null if the button has no label.

See Also
java.awt.Button#getLabel
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 ActionListeners as optional data. The non-serializable ActionListeners 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: actionListenerK indicating an ActionListener object
See Also
AWTEventMulticaster#save(ObjectOutputStream, String, EventListener), java.awt.Component#actionListenerK, readObject(ObjectInputStream)
java.awt back to summary

protected Class Button.AccessibleAWTButton

extends AccessibleAWTComponent
implements AccessibleAction, AccessibleValue
Class Inheritance
All Implemented Interfaces
javax.accessibility.AccessibleValue, javax.accessibility.AccessibleAction

This class implements accessibility support for the Button class. It provides an implementation of the Java Accessibility API appropriate to button 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
protected
AccessibleAWTButton()

Constructs an AccessibleAWTButton.

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:

1, 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 String

Returns:

the localized name of the object -- can be null if this object does not have a name
getAccessibleName
()

Overrides java.awt.Component.AccessibleAWTComponent.getAccessibleName.

Get the accessible name of this 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 AccessibleValue

Returns:

this object
getAccessibleValue
()

Overrides javax.accessibility.AccessibleContext.getAccessibleValue.

Get the AccessibleValue associated with this object.
public Number

Returns:

An Integer of 0 if this isn't selected or an Integer of 1 if this is selected.
getCurrentAccessibleValue
()

Implements javax.accessibility.AccessibleValue.getCurrentAccessibleValue.

Get the value of this object as a Number.
public Number

Returns:

An Integer of 0.
getMaximumAccessibleValue
()

Implements javax.accessibility.AccessibleValue.getMaximumAccessibleValue.

Get the maximum value of this object as a Number.
public Number

Returns:

An Integer of 0.
getMinimumAccessibleValue
()

Implements javax.accessibility.AccessibleValue.getMinimumAccessibleValue.

Get the minimum value of this object as a Number.
public boolean

Returns:

True if the value was set.
setCurrentAccessibleValue
(Number
the number to use for the value
n
)

Implements javax.accessibility.AccessibleValue.setCurrentAccessibleValue.

Set the value of this object as a Number.
Inherited from java.awt.Component.AccessibleAWTComponent:
addFocusListeneraddPropertyChangeListenercontainsgetAccessibleAtgetAccessibleChildgetAccessibleChildrenCountgetAccessibleComponentgetAccessibleDescriptiongetAccessibleIndexInParentgetAccessibleParentgetAccessibleStateSetgetBackgroundgetBoundsgetCursorgetFontgetFontMetricsgetForegroundgetLocalegetLocationgetLocationOnScreengetSizeisEnabledisFocusTraversableisShowingisVisibleremoveFocusListenerremovePropertyChangeListenerrequestFocussetBackgroundsetBoundssetCursorsetEnabledsetFontsetForegroundsetLocationsetSizesetVisible

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

AccessibleAWTButtonback to summary
protected AccessibleAWTButton()

Constructs an AccessibleAWTButton.

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. The default behavior of a button is to have one action - toggle the button.

Returns:int

1, 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

Returns:String

Doc from javax.accessibility.AccessibleAction.getAccessibleActionDescription.

a String description of the action

getAccessibleNameback to summary
public String getAccessibleName()

Overrides java.awt.Component.AccessibleAWTComponent.getAccessibleName.

Get the accessible name of this object.

Returns:String

the localized name of the object -- can be null if this object does not have a name

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
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.

Returns:Number

An Integer of 0 if this isn't selected or an Integer of 1 if this is selected.

See Also
javax.swing.AbstractButton#isSelected()
getMaximumAccessibleValueback to summary
public Number getMaximumAccessibleValue()

Implements javax.accessibility.AccessibleValue.getMaximumAccessibleValue.

Get the maximum value of this object as a Number.

Returns:Number

An Integer of 0.

getMinimumAccessibleValueback to summary
public Number getMinimumAccessibleValue()

Implements javax.accessibility.AccessibleValue.getMinimumAccessibleValue.

Get the minimum value of this object as a Number.

Returns:Number

An Integer of 0.

setCurrentAccessibleValueback to summary
public boolean setCurrentAccessibleValue(Number n)

Implements javax.accessibility.AccessibleValue.setCurrentAccessibleValue.

Set the value of this object as a Number.

Parameters
n:Number

Doc from javax.accessibility.AccessibleValue.setCurrentAccessibleValue.

the number to use for the value

Returns:boolean

True if the value was set.