src/share/classes/javax/swing/ButtonGroup.java

Print this page




  34  * a set of buttons. Creating a set of buttons with the
  35  * same <code>ButtonGroup</code> object means that
  36  * turning "on" one of those buttons
  37  * turns off all other buttons in the group.
  38  * <p>
  39  * A <code>ButtonGroup</code> can be used with
  40  * any set of objects that inherit from <code>AbstractButton</code>.
  41  * Typically a button group contains instances of
  42  * <code>JRadioButton</code>,
  43  * <code>JRadioButtonMenuItem</code>,
  44  * or <code>JToggleButton</code>.
  45  * It wouldn't make sense to put an instance of
  46  * <code>JButton</code> or <code>JMenuItem</code>
  47  * in a button group
  48  * because <code>JButton</code> and <code>JMenuItem</code>
  49  * don't implement the selected state.
  50  * <p>
  51  * Initially, all buttons in the group are unselected.
  52  * <p>
  53  * For examples and further information on using button groups see
  54  * <a href="http://java.sun.com/docs/books/tutorial/uiswing/components/button.html#radiobutton">How to Use Radio Buttons</a>,
  55  * a section in <em>The Java Tutorial</em>.
  56  * <p>
  57  * <strong>Warning:</strong>
  58  * Serialized objects of this class will not be compatible with
  59  * future Swing releases. The current serialization support is
  60  * appropriate for short term storage or RMI between applications running
  61  * the same version of Swing.  As of 1.4, support for long term storage
  62  * of all JavaBeans<sup><font size="-2">TM</font></sup>
  63  * has been added to the <code>java.beans</code> package.
  64  * Please see {@link java.beans.XMLEncoder}.
  65  *
  66  * @author Jeff Dinkins
  67  */
  68 @SuppressWarnings("serial")
  69 public class ButtonGroup implements Serializable {
  70 
  71     // the list of buttons participating in this group
  72     protected Vector<AbstractButton> buttons = new Vector<AbstractButton>();
  73 
  74     /**




  34  * a set of buttons. Creating a set of buttons with the
  35  * same <code>ButtonGroup</code> object means that
  36  * turning "on" one of those buttons
  37  * turns off all other buttons in the group.
  38  * <p>
  39  * A <code>ButtonGroup</code> can be used with
  40  * any set of objects that inherit from <code>AbstractButton</code>.
  41  * Typically a button group contains instances of
  42  * <code>JRadioButton</code>,
  43  * <code>JRadioButtonMenuItem</code>,
  44  * or <code>JToggleButton</code>.
  45  * It wouldn't make sense to put an instance of
  46  * <code>JButton</code> or <code>JMenuItem</code>
  47  * in a button group
  48  * because <code>JButton</code> and <code>JMenuItem</code>
  49  * don't implement the selected state.
  50  * <p>
  51  * Initially, all buttons in the group are unselected.
  52  * <p>
  53  * For examples and further information on using button groups see
  54  * <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/button.html#radiobutton">How to Use Radio Buttons</a>,
  55  * a section in <em>The Java Tutorial</em>.
  56  * <p>
  57  * <strong>Warning:</strong>
  58  * Serialized objects of this class will not be compatible with
  59  * future Swing releases. The current serialization support is
  60  * appropriate for short term storage or RMI between applications running
  61  * the same version of Swing.  As of 1.4, support for long term storage
  62  * of all JavaBeans<sup><font size="-2">TM</font></sup>
  63  * has been added to the <code>java.beans</code> package.
  64  * Please see {@link java.beans.XMLEncoder}.
  65  *
  66  * @author Jeff Dinkins
  67  */
  68 @SuppressWarnings("serial")
  69 public class ButtonGroup implements Serializable {
  70 
  71     // the list of buttons participating in this group
  72     protected Vector<AbstractButton> buttons = new Vector<AbstractButton>();
  73 
  74     /**