javax.swing

Class JRadioButtonMenuItem

public class JRadioButtonMenuItem extends JMenuItem implements Accessible

This class represents JRadioButtonMenuItem. Its behaviour is very similar to JRadioButton. Just like JRadioButton, user can check and uncheck this menu item by clicking on it. JRadioButtonMenuItem uses ToggleButtonModel to keep track of its selection. If the JRadioButtonMenuItem is included in the button group, then only one JRadioButtonMenuItem can be selected at one time.
Nested Class Summary
protected classJRadioButtonMenuItem.AccessibleJRadioButtonMenuItem
Provides the accessibility features for the JRadioButtonMenuItem component.
Constructor Summary
JRadioButtonMenuItem()
Creates a new JRadioButtonMenuItem object.
JRadioButtonMenuItem(Icon icon)
Creates a new JRadioButtonMenuItem with specified icon
JRadioButtonMenuItem(String text)
Creates a new JRadioButtonMenuItem with specified label
JRadioButtonMenuItem(Action action)
Creates a new JRadioButtonMenuItem using specified action
JRadioButtonMenuItem(String text, Icon icon)
Creates a new JRadioButtonMenuItem with specified label and icon
JRadioButtonMenuItem(String text, boolean selected)
Creates a new JRadioButtonMenuItem with specified label and marked selected if 'selected' is true.
JRadioButtonMenuItem(Icon icon, boolean selected)
Creates a new JRadioButtonMenuItem with specified icon and given selected state
JRadioButtonMenuItem(String text, Icon icon, boolean selected)
Creates a new JRadioButtonMenuItem with specified label, icon and selected state.
Method Summary
AccessibleContextgetAccessibleContext()
Returns the object that provides accessibility features for this JRadioButtonMenuItem component.
StringgetUIClassID()
This method returns a name to identify which look and feel class will be the UI delegate for the menuItem.
protected StringparamString()
Returns a string describing the attributes for the JRadioButtonMenuItem component, for use in debugging.
voidrequestFocus()
This method overrides JComponent.requestFocus with an empty implementation, since JRadioButtonMenuItems should not receve focus in general.

Constructor Detail

JRadioButtonMenuItem

public JRadioButtonMenuItem()
Creates a new JRadioButtonMenuItem object.

JRadioButtonMenuItem

public JRadioButtonMenuItem(Icon icon)
Creates a new JRadioButtonMenuItem with specified icon

Parameters: icon Icon to be used for this menu item

JRadioButtonMenuItem

public JRadioButtonMenuItem(String text)
Creates a new JRadioButtonMenuItem with specified label

Parameters: text Label for this menu item

JRadioButtonMenuItem

public JRadioButtonMenuItem(Action action)
Creates a new JRadioButtonMenuItem using specified action

Parameters: action Action for this menu item

JRadioButtonMenuItem

public JRadioButtonMenuItem(String text, Icon icon)
Creates a new JRadioButtonMenuItem with specified label and icon

Parameters: text Label for this menu item icon Icon for this menu item

JRadioButtonMenuItem

public JRadioButtonMenuItem(String text, boolean selected)
Creates a new JRadioButtonMenuItem with specified label and marked selected if 'selected' is true.

Parameters: text Text for this menu item selected Selected state of this menu item

JRadioButtonMenuItem

public JRadioButtonMenuItem(Icon icon, boolean selected)
Creates a new JRadioButtonMenuItem with specified icon and given selected state

Parameters: icon Icon for this menu item selected Selected state for this menu item

JRadioButtonMenuItem

public JRadioButtonMenuItem(String text, Icon icon, boolean selected)
Creates a new JRadioButtonMenuItem with specified label, icon and selected state.

Parameters: text Label for this menu item icon Icon to be use for this menu item selected selected state of this menu item

Method Detail

getAccessibleContext

public AccessibleContext getAccessibleContext()
Returns the object that provides accessibility features for this JRadioButtonMenuItem component.

Returns: The accessible context (an instance of {@link AccessibleJRadioButtonMenuItem}).

getUIClassID

public String getUIClassID()
This method returns a name to identify which look and feel class will be the UI delegate for the menuItem.

Returns: The Look and Feel classID. "JRadioButtonMenuItemUI"

paramString

protected String paramString()
Returns a string describing the attributes for the JRadioButtonMenuItem component, for use in debugging. The return value is guaranteed to be non-null, but the format of the string may vary between implementations.

Returns: A string describing the attributes of the JRadioButtonMenuItem.

requestFocus

public void requestFocus()
This method overrides JComponent.requestFocus with an empty implementation, since JRadioButtonMenuItems should not receve focus in general.