Top Description Inners Fields Constructors Methods
java.awt

public Class MenuItem

extends MenuComponent
implements Accessible
Class Inheritance
All Implemented Interfaces
javax.accessibility.Accessible
Known Direct Subclasses
java.awt.CheckboxMenuItem, java.awt.Menu
Imports
java.awt.event.ActionEvent, .ActionListener, .InputEvent, .KeyEvent, java.awt.peer.MenuItemPeer, java.io.IOException, .ObjectInputStream, .ObjectOutputStream, .Serial, java.util.EventListener, javax.accessibility.Accessible, .AccessibleAction, .AccessibleContext, .AccessibleRole, .AccessibleValue, sun.awt.AWTAccessor

All items in a menu must belong to the class MenuItem, or one of its subclasses.

The default MenuItem object embodies a simple labeled menu item.

This picture of a menu bar shows five menu items: The following text describes this
graphic.
The first two items are simple menu items, labeled "Basic" and "Simple". Following these two items is a separator, which is itself a menu item, created with the label "-". Next is an instance of CheckboxMenuItem labeled "Check". The final menu item is a submenu labeled "More Examples", and this submenu is an instance of Menu.

When a menu item is selected, AWT sends an action event to the menu item. Since the event is an instance of ActionEvent, the processEvent method examines the event and passes it along to processActionEvent. The latter method redirects the event to any ActionListener objects that have registered an interest in action events generated by this menu item.

Note that the subclass Menu overrides this behavior and does not send any event to the frame until one of its subitems is selected.

Author
Sami Shaio

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected class
MenuItem.AccessibleAWTMenuItem

Inner class of MenuItem used to provide default support for accessibility.

Field Summary

Modifier and TypeField and Description
private volatile String
actionCommand

This field indicates the command that has been issued by a particular menu item.

private transient volatile ActionListener
private static final String
private volatile boolean
enabled

A value to indicate whether a menu item is enabled or not.

pack-priv volatile long
eventMask

The eventMask is ONLY set by subclasses via enableEvents.

pack-priv volatile String
label

label is the label of a menu item.

private static int
private static final long
serialVersionUID

Hides java.awt.MenuComponent.serialVersionUID.

Use serialVersionUID from JDK 1.1 for interoperability.
private volatile MenuShortcut
shortcut

A sequence of key stokes that ia associated with a menu item.

Inherited from java.awt.MenuComponent:
accessibleContextactionListenerKitemListenerKnewEventsOnlyparentpeer

Constructor Summary

AccessConstructor and Description

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

public void
addNotify()

Creates the menu item's peer.

pack-priv String
constructComponentName()

Overrides java.awt.MenuComponent.constructComponentName.

Construct a name for this MenuComponent.
public void
deleteShortcut()

Delete any MenuShortcut object associated with this menu item.

pack-priv void
public synchronized void
disable()

Deprecated As of JDK version 1.1, replaced by setEnabled(boolean).
protected final void
disableEvents(long
the event mask defining the event types
eventsToDisable
)

Disables event delivery to this menu item for events defined by the specified event mask parameter.

pack-priv void
doMenuEvent(long when, int modifiers)

public synchronized void
enable()

Deprecated As of JDK version 1.1, replaced by setEnabled(boolean).
public void
enable(boolean
if true, enables this menu item; otherwise disables
b
)

Deprecated As of JDK version 1.1, replaced by setEnabled(boolean).
Sets whether or not this menu item can be chosen.
protected final void
enableEvents(long
the event mask defining the event types
eventsToEnable
)

Enables event delivery to this menu item for events to be defined by the specified event mask parameter

Since event types are automatically enabled when a listener for that type is added to the menu item, this method only needs to be invoked by subclasses of MenuItem which desire to have the specified event types delivered to processEvent regardless of whether a listener is registered.

pack-priv boolean
public AccessibleContext

Returns:

an AccessibleAWTMenuItem that serves as the AccessibleContext of this MenuItem
getAccessibleContext
()

Overrides java.awt.MenuComponent.getAccessibleContext.

Implements javax.accessibility.Accessible.getAccessibleContext.

Gets the AccessibleContext associated with this MenuItem.
public String

Returns:

the action command name
getActionCommand
()

Gets the command name of the action event that is fired by this menu item.

pack-priv final String
public synchronized ActionListener[]

Returns:

all of this menu item'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 menu item.

public String

Returns:

the label of this menu item, or null if this menu item has no label.
getLabel
()

Gets the label for this menu item.

public <
the type of the listeners
T extends EventListener
>
T[]

Returns:

an array of all objects registered as FooListeners on this menu item, 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
)

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

public MenuShortcut

Returns:

the menu shortcut associated with this menu item, or null if none has been specified.
getShortcut
()

Get the MenuShortcut object associated with this menu item,

pack-priv MenuItem
pack-priv boolean
private static native void
initIDs()

Initialize JNI field and method IDs

public boolean

Returns:

true if the item is enabled; otherwise false
isEnabled
()

Checks whether this menu item is enabled.

private boolean
public String

Returns:

the parameter string of this menu item
paramString
()

Overrides java.awt.MenuComponent.paramString.

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

Processes action events occurring on this menu item, by dispatching them to any registered ActionListener objects.

protected void
processEvent(AWTEvent
the event
e
)

Overrides java.awt.MenuComponent.processEvent.

Processes events on this menu item.
private void
readObject(ObjectInputStream
the ObjectInputStream to read
s
)

Hides java.awt.MenuComponent.readObject.

Reads the ObjectInputStream and if it isn't null adds a listener to receive action events fired by the Menu Item.
public synchronized void
removeActionListener(ActionListener
the action listener.
l
)

Removes the specified action listener so it no longer receives action events from this menu item.

public void
setActionCommand(String
the action command to be set for this menu item.
command
)

Sets the command name of the action event that is fired by this menu item.

public synchronized void
setEnabled(boolean
if true, enables this menu item; if false, disables it.
b
)

Sets whether or not this menu item can be chosen.

public synchronized void
setLabel(String
the new label, or null for no label.
label
)

Sets the label for this menu item to the specified label.

public void
setShortcut(MenuShortcut
the menu shortcut to associate with this menu item.
s
)

Set the MenuShortcut object associated with this menu item.

private void
writeObject(ObjectOutputStream
the ObjectOutputStream to write
s
)

Writes default serializable fields to stream.

Inherited from java.awt.MenuComponent:
dispatchEventdispatchEventImplgetAccessControlContextgetAccessibleChildIndexgetAccessibleIndexInParentgetAccessibleStateSetgetComponentFactorygetFontgetFont_NoClientCodegetNamegetParentgetParent_NoClientCodegetTreeLockpostEventremoveNotifysetFontsetNametoString

Field Detail

actionCommandback to summary
private volatile String actionCommand

This field indicates the command that has been issued by a particular menu item. By default the actionCommand is the label of the menu item, unless it has been set using setActionCommand.

See Also
setActionCommand(String), getActionCommand()
actionListenerback to summary
private transient volatile ActionListener actionListener
baseback to summary
private static final String base
enabledback to summary
private volatile boolean enabled

A value to indicate whether a menu item is enabled or not. If it is enabled, enabled will be set to true. Else enabled will be set to false.

See Also
isEnabled(), setEnabled(boolean)
eventMaskback to summary
pack-priv volatile long eventMask

The eventMask is ONLY set by subclasses via enableEvents. The mask should NOT be set when listeners are registered so that we can distinguish the difference between when listeners request events and subclasses request them.

labelback to summary
pack-priv volatile String label

label is the label of a menu item. It can be any string.

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

Hides java.awt.MenuComponent.serialVersionUID.

Use serialVersionUID from JDK 1.1 for interoperability.

Annotations
@Serial
shortcutback to summary
private volatile MenuShortcut shortcut

A sequence of key stokes that ia associated with a menu item. Note :in 1.1.2 you must use setActionCommand() on a menu item in order for its shortcut to work.

See Also
getShortcut(), setShortcut(MenuShortcut), deleteShortcut()

Constructor Detail

Method Detail

addActionListenerback to summary
public synchronized void addActionListener(ActionListener l)

Adds the specified action listener to receive action events from this menu item. 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.ActionEvent, java.awt.event.ActionListener
addNotifyback to summary
public void addNotify()

Creates the menu item's peer. The peer allows us to modify the appearance of the menu item without changing its functionality.

constructComponentNameback to summary
pack-priv String constructComponentName()

Overrides java.awt.MenuComponent.constructComponentName.

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

Returns:String

Doc from java.awt.MenuComponent.constructComponentName.

a name for this MenuComponent

deleteShortcutback to summary
public void deleteShortcut()

Delete any MenuShortcut object associated with this menu item.

Since
1.1
deleteShortcutback to summary
pack-priv void deleteShortcut(MenuShortcut s)
disableback to summary
public synchronized void disable()

Deprecated

As of JDK version 1.1, replaced by setEnabled(boolean).

Annotations
@Deprecated
disableEventsback to summary
protected final void disableEvents(long eventsToDisable)

Disables event delivery to this menu item for events defined by the specified event mask parameter.

Parameters
eventsToDisable:long

the event mask defining the event types

Since
1.1
See Also
java.awt.MenuItem#processEvent, java.awt.MenuItem#enableEvents, java.awt.Component#disableEvents
doMenuEventback to summary
pack-priv void doMenuEvent(long when, int modifiers)
enableback to summary
public synchronized void enable()

Deprecated

As of JDK version 1.1, replaced by setEnabled(boolean).

Annotations
@Deprecated
enableback to summary
public void enable(boolean b)

Deprecated

As of JDK version 1.1, replaced by setEnabled(boolean).

Sets whether or not this menu item can be chosen.

Parameters
b:boolean

if true, enables this menu item; otherwise disables

Annotations
@Deprecated
enableEventsback to summary
protected final void enableEvents(long eventsToEnable)

Enables event delivery to this menu item for events to be defined by the specified event mask parameter

Since event types are automatically enabled when a listener for that type is added to the menu item, this method only needs to be invoked by subclasses of MenuItem which desire to have the specified event types delivered to processEvent regardless of whether a listener is registered.

Parameters
eventsToEnable:long

the event mask defining the event types

Since
1.1
See Also
java.awt.MenuItem#processEvent, java.awt.MenuItem#disableEvents, java.awt.Component#enableEvents
eventEnabledback to summary
pack-priv boolean eventEnabled(AWTEvent e)

Overrides java.awt.MenuComponent.eventEnabled.

getAccessibleContextback to summary
public AccessibleContext getAccessibleContext()

Overrides java.awt.MenuComponent.getAccessibleContext.

Implements javax.accessibility.Accessible.getAccessibleContext.

Gets the AccessibleContext associated with this MenuItem. For menu items, the AccessibleContext takes the form of an AccessibleAWTMenuItem. A new AccessibleAWTMenuItem instance is created if necessary.

Returns:AccessibleContext

an AccessibleAWTMenuItem that serves as the AccessibleContext of this MenuItem

Since
1.3
getActionCommandback to summary
public String getActionCommand()

Gets the command name of the action event that is fired by this menu item.

Returns:String

the action command name

Since
1.1
See Also
java.awt.MenuItem#setActionCommand
getActionCommandImplback to summary
pack-priv final String getActionCommandImpl()
getActionListenersback to summary
public synchronized ActionListener[] getActionListeners()

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

Returns:ActionListener[]

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

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

Gets the label for this menu item.

Returns:String

the label of this menu item, or null if this menu item has no label.

Since
1.0
See Also
java.awt.MenuItem#setLabel
getListenersback to summary
public <T extends EventListener> T[] getListeners(Class<T> listenerType)

Returns an array of all the objects currently registered as FooListeners upon this MenuItem. 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 MenuItem m for its action listeners with the following code:

ActionListener[] als = (ActionListener[])(m.getListeners(ActionListener.class));
If no such listeners exist, this method returns an empty array.
Parameters
<T>
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 menu item, 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
getShortcutback to summary
public MenuShortcut getShortcut()

Get the MenuShortcut object associated with this menu item,

Returns:MenuShortcut

the menu shortcut associated with this menu item, or null if none has been specified.

Since
1.1
See Also
java.awt.MenuItem#setShortcut
getShortcutMenuItemback to summary
pack-priv MenuItem getShortcutMenuItem(MenuShortcut s)
handleShortcutback to summary
pack-priv boolean handleShortcut(KeyEvent e)
Annotations
@SuppressWarnings:deprecation
initIDsback to summary
private static native void initIDs()

Initialize JNI field and method IDs

isEnabledback to summary
public boolean isEnabled()

Checks whether this menu item is enabled.

Returns:boolean

true if the item is enabled; otherwise false

Since
1.0
See Also
java.awt.MenuItem#setEnabled
isItemEnabledback to summary
private boolean isItemEnabled()
paramStringback to summary
public String paramString()

Overrides java.awt.MenuComponent.paramString.

Returns a string representing the state of this MenuItem. 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 menu item

processActionEventback to summary
protected void processActionEvent(ActionEvent e)

Processes action events occurring on this menu item, by dispatching them to any registered ActionListener objects. This method is not called unless action events are enabled for this component. 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.ActionEvent, java.awt.event.ActionListener, java.awt.MenuItem#enableEvents
processEventback to summary
protected void processEvent(AWTEvent e)

Overrides java.awt.MenuComponent.processEvent.

Processes events on this menu item. If the event is an instance of ActionEvent, it invokes processActionEvent, another method defined by MenuItem.

Currently, menu items only support action events.

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.MenuItem#processActionEvent
readObjectback to summary
private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException, HeadlessException

Hides java.awt.MenuComponent.readObject.

Reads the ObjectInputStream and if it isn't null adds a listener to receive action events fired by the Menu Item. 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), writeObject(ObjectOutputStream)
removeActionListenerback to summary
public synchronized void removeActionListener(ActionListener l)

Removes the specified action listener so it no longer receives action events from this menu item. 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.ActionEvent, java.awt.event.ActionListener
setActionCommandback to summary
public void setActionCommand(String command)

Sets the command name of the action event that is fired by this menu item.

By default, the action command is set to the label of the menu item.

Parameters
command:String

the action command to be set for this menu item.

Since
1.1
See Also
java.awt.MenuItem#getActionCommand
setEnabledback to summary
public synchronized void setEnabled(boolean b)

Sets whether or not this menu item can be chosen.

Parameters
b:boolean

if true, enables this menu item; if false, disables it.

Since
1.1
See Also
java.awt.MenuItem#isEnabled
setLabelback to summary
public synchronized void setLabel(String label)

Sets the label for this menu item to the specified label.

Parameters
label:String

the new label, or null for no label.

Since
1.0
See Also
java.awt.MenuItem#getLabel
setShortcutback to summary
public void setShortcut(MenuShortcut s)

Set the MenuShortcut object associated with this menu item. If a menu shortcut is already associated with this menu item, it is replaced.

Parameters
s:MenuShortcut

the menu shortcut to associate with this menu item.

Since
1.1
See Also
java.awt.MenuItem#getShortcut
writeObjectback to summary
private void writeObject(ObjectOutputStream s) throws IOException

Writes default serializable fields to stream. Writes a list of serializable ActionListeners as optional data. The non-serializable listeners 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), readObject(ObjectInputStream)
java.awt back to summary

protected Class MenuItem.AccessibleAWTMenuItem

extends AccessibleAWTMenuComponent
implements AccessibleAction, AccessibleValue
Class Inheritance
All Implemented Interfaces
javax.accessibility.AccessibleValue, javax.accessibility.AccessibleAction
Known Direct Subclasses
java.awt.CheckboxMenuItem.AccessibleAWTCheckboxMenuItem, java.awt.Menu.AccessibleAWTMenu

Inner class of MenuItem used to provide default support for accessibility. This class is not meant to be used directly by application developers, but is instead meant only to be subclassed by menu component developers.

This class implements accessibility support for the MenuItem class. It provides an implementation of the Java Accessibility API appropriate to menu item user-interface elements.

Since
1.3

Field Summary

Modifier and TypeField and Description
private static final long
serialVersionUID

Hides java.awt.MenuComponent.AccessibleAWTMenuComponent.serialVersionUID.

Use serialVersionUID from JDK 1.3 for interoperability.

Constructor Summary

AccessConstructor and Description
protected
AccessibleAWTMenuItem()

Constructs an AccessibleAWTMenuItem.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the action was performed; otherwise 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.MenuComponent.AccessibleAWTMenuComponent.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.MenuComponent.AccessibleAWTMenuComponent.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.MenuComponent.AccessibleAWTMenuComponent:
addAccessibleSelectionaddFocusListenerclearAccessibleSelectioncontainsgetAccessibleAtgetAccessibleChildgetAccessibleChildrenCountgetAccessibleComponentgetAccessibleDescriptiongetAccessibleIndexInParentgetAccessibleParentgetAccessibleSelectiongetAccessibleSelectiongetAccessibleSelectionCountgetAccessibleStateSetgetBackgroundgetBoundsgetCursorgetFontgetFontMetricsgetForegroundgetLocalegetLocationgetLocationOnScreengetSizeisAccessibleChildSelectedisEnabledisFocusTraversableisShowingisVisibleremoveAccessibleSelectionremoveFocusListenerrequestFocusselectAllAccessibleSelectionsetBackgroundsetBoundssetCursorsetEnabledsetFontsetForegroundsetLocationsetSizesetVisible

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.awt.MenuComponent.AccessibleAWTMenuComponent.serialVersionUID.

Use serialVersionUID from JDK 1.3 for interoperability.

Annotations
@Serial

Constructor Detail

AccessibleAWTMenuItemback to summary
protected AccessibleAWTMenuItem()

Constructs an AccessibleAWTMenuItem.

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; otherwise 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 menu item is to have one action.

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.MenuComponent.AccessibleAWTMenuComponent.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.MenuComponent.AccessibleAWTMenuComponent.getAccessibleRole.

Get the role of this object.

Returns:AccessibleRole

an instance of AccessibleRole describing the role of the object

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.