![]() ![]() |
![]() |
![]() ![]() ![]() ![]() |
![]() |
This specification describes the API for the Swing JRadioButton class.
In Swing, a JRadioButton object is a component that displays both a radio-style button and a text label. When the radio button is pressed and released, an ItemEvent is sent to all registered ItemListeners to inform them that the radio button has been selected or deselected.
The JRadioButton class -- along with JButton, JToggleButton, and JRadioButton -- is descended from the AbstractButton class. (For details, see the specification titled The Swing Button API.)
The JRadioButton class implements a button model interface named ButtonModel. The ButtonModel interface is shared by buttons, checkboxes, toggle buttons, and radio buttons. For more information on this interface, see the The Swing Button API.
Radio buttons can be arranged in groups, which are instantiations of a class named ButtonGroup. When a radio button is a member of a ButtonGroup, Swing makes it possible for the user to select only one one radio button in the group at a time.
Swing allows you to position the label text that is associated with a JRadioButton component. Specifically, Swing supports two kinds of text positioning:
As previously noted, the JRadioButton implements a ButtonModel interface that is shared by JButton, JToggleButton, JCheckbox, and JRadioButton. The isSelected state is used by JToggleButton, JCheckbox, and RadioButton, but not by JButton. To learn more about the methods defined in the ButtonModel interface, see the ButtonModel API.
JRadioButton components are a source of ItemEvents. By registering itself as an ItemListener of a radio button, an object can ensure that it will be notified when a radio button has been selected or deselected.
Version 0.5. Last modified 10/1/97.
Copyright © 1995-97 Sun
Microsystems, Inc. All Rights Reserved.