|
JavaTM 2 Platform Std. Ed. v1.3.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.AbstractButton | +--javax.swing.JToggleButton | +--javax.swing.JRadioButton
An implementation of a radio button -- an item that can be selected or
deselected, and which displays its state to the user.
Used with a ButtonGroup
object to create a group of buttons
in which only one button at a time can be selected. (Create a ButtonGroup
object and use its add
method to include the JRadioButton objects
in the group.)
Note: The ButtonGroup object is a logical grouping -- not a physical grouping. Tocreate a button panel, you should still create aJPanel
or similar container-object and add aBorder
to it to set it off from surrounding components.
See How to Use Buttons, Check Boxes, and Radio Buttons in The Java Tutorial for further documentation.
For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions, see the JRadioButton key assignments.
Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.
ButtonGroup
,
JCheckBox
, Serialized FormInner Class Summary | |
protected class |
JRadioButton.AccessibleJRadioButton
This class implements accessibility support for the JRadioButton class. |
Inner classes inherited from class javax.swing.JToggleButton |
JToggleButton.AccessibleJToggleButton, JToggleButton.ToggleButtonModel |
Inner classes inherited from class javax.swing.AbstractButton |
AbstractButton.AccessibleAbstractButton, AbstractButton.ButtonChangeListener |
Inner classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
Inner classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
Inner classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent |
Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface javax.swing.SwingConstants |
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NORTH, NORTH_EAST, NORTH_WEST, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
JRadioButton()
Creates an initially unselected radio button with no set text. |
|
JRadioButton(Action a)
Creates a radiobutton where properties are taken from the Action supplied. |
|
JRadioButton(Icon icon)
Creates an initially unselected radio button with the specified image but no text. |
|
JRadioButton(Icon icon,
boolean selected)
Creates a radio button with the specified image and selection state, but no text. |
|
JRadioButton(String text)
Creates an unselected radio button with the specified text. |
|
JRadioButton(String text,
boolean selected)
Creates a radio button with the specified text and selection state. |
|
JRadioButton(String text,
Icon icon)
Creates a radio button that has the specified text and image, and that is initially unselected. |
|
JRadioButton(String text,
Icon icon,
boolean selected)
Creates a radio button that has the specified text, image, and selection state. |
Method Summary | |
protected void |
configurePropertiesFromAction(Action a)
Factory method which sets the ActionEvent source's properties according to values from the Action instance. |
protected PropertyChangeListener |
createActionPropertyChangeListener(Action a)
Factory method which creates the PropertyChangeListener used to update the ActionEvent source as properties change on its Action instance. |
AccessibleContext |
getAccessibleContext()
Gets the AccessibleContext associated with this JRadioButton. |
String |
getUIClassID()
Returns the name of the L&F class that renders this component. |
protected String |
paramString()
Returns a string representation of this JRadioButton. |
void |
updateUI()
Notification from the UIFactory that the L&F has changed. |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public JRadioButton()
public JRadioButton(Icon icon)
icon
- the image that the button should displaypublic JRadioButton(Action a)
public JRadioButton(Icon icon, boolean selected)
icon
- the image that the button should displayselected
- if true, the button is initially selected;
otherwise, the button is initially unselectedpublic JRadioButton(String text)
text
- the string displayed on the radio buttonpublic JRadioButton(String text, boolean selected)
text
- the string displayed on the radio buttonselected
- if true, the button is initially selected;
otherwise, the button is initially unselectedpublic JRadioButton(String text, Icon icon)
text
- the string displayed on the radio buttonicon
- the image that the button should displaypublic JRadioButton(String text, Icon icon, boolean selected)
text
- the string displayed on the radio buttonicon
- the image that the button should displayMethod Detail |
public void updateUI()
updateUI
in class JToggleButton
JComponent.updateUI()
public String getUIClassID()
getUIClassID
in class JToggleButton
JComponent.getUIClassID()
,
UIDefaults.getUI(javax.swing.JComponent)
protected void configurePropertiesFromAction(Action a)
configurePropertiesFromAction
in class AbstractButton
a
- the Action from which to get the properties, or nullAction
,
AbstractButton.setAction(javax.swing.Action)
protected PropertyChangeListener createActionPropertyChangeListener(Action a)
createActionPropertyChangeListener
in class AbstractButton
Action
,
AbstractButton.setAction(javax.swing.Action)
protected String paramString()
null
.paramString
in class JToggleButton
public AccessibleContext getAccessibleContext()
getAccessibleContext
in interface Accessible
getAccessibleContext
in class JToggleButton
|
JavaTM 2 Platform Std. Ed. v1.3.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Java, Java 2D, and JDBC are trademarks or registered trademarks of Oracle and/or its affiliates, in the US and other countries.
Copyright © 1995, 2010 Oracle and/or its affiliates. All rights reserved.