< prev index next >

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

Print this page

        

*** 30,53 **** import java.io.Serializable; /** * This class is used to create a multiple-exclusion scope for * a set of buttons. Creating a set of buttons with the ! * same <code>ButtonGroup</code> object means that * turning "on" one of those buttons * turns off all other buttons in the group. * <p> ! * A <code>ButtonGroup</code> can be used with ! * any set of objects that inherit from <code>AbstractButton</code>. * Typically a button group contains instances of ! * <code>JRadioButton</code>, ! * <code>JRadioButtonMenuItem</code>, ! * or <code>JToggleButton</code>. * It wouldn't make sense to put an instance of ! * <code>JButton</code> or <code>JMenuItem</code> * in a button group ! * because <code>JButton</code> and <code>JMenuItem</code> * don't implement the selected state. * <p> * Initially, all buttons in the group are unselected. * <p> * For examples and further information on using button groups see --- 30,53 ---- import java.io.Serializable; /** * This class is used to create a multiple-exclusion scope for * a set of buttons. Creating a set of buttons with the ! * same {@code ButtonGroup} object means that * turning "on" one of those buttons * turns off all other buttons in the group. * <p> ! * A {@code ButtonGroup} can be used with ! * any set of objects that inherit from {@code AbstractButton}. * Typically a button group contains instances of ! * {@code JRadioButton}, ! * {@code JRadioButtonMenuItem}, ! * or {@code JToggleButton}. * It wouldn't make sense to put an instance of ! * {@code JButton} or {@code JMenuItem} * in a button group ! * because {@code JButton} and {@code JMenuItem} * don't implement the selected state. * <p> * Initially, all buttons in the group are unselected. * <p> * For examples and further information on using button groups see
*** 58,68 **** * 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. As of 1.4, support for long term storage * of all JavaBeans&trade; ! * has been added to the <code>java.beans</code> package. * Please see {@link java.beans.XMLEncoder}. * * @author Jeff Dinkins * @since 1.2 */ --- 58,68 ---- * 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. As of 1.4, support for long term storage * of all JavaBeans&trade; ! * has been added to the {@code java.beans} package. * Please see {@link java.beans.XMLEncoder}. * * @author Jeff Dinkins * @since 1.2 */
*** 78,88 **** * The current selection. */ ButtonModel selection = null; /** ! * Creates a new <code>ButtonGroup</code>. */ public ButtonGroup() {} /** * Adds the button to the group. --- 78,88 ---- * The current selection. */ ButtonModel selection = null; /** ! * Creates a new {@code ButtonGroup}. */ public ButtonGroup() {} /** * Adds the button to the group.
*** 120,130 **** b.getModel().setGroup(null); } /** * Clears the selection such that none of the buttons ! * in the <code>ButtonGroup</code> are selected. * * @since 1.6 */ public void clearSelection() { if (selection != null) { --- 120,130 ---- b.getModel().setGroup(null); } /** * Clears the selection such that none of the buttons ! * in the {@code ButtonGroup} are selected. * * @since 1.6 */ public void clearSelection() { if (selection != null) {
*** 135,145 **** } /** * Returns all the buttons that are participating in * this group. ! * @return an <code>Enumeration</code> of the buttons in this group */ public Enumeration<AbstractButton> getElements() { return buttons.elements(); } --- 135,145 ---- } /** * Returns all the buttons that are participating in * this group. ! * @return an {@code Enumeration} of the buttons in this group */ public Enumeration<AbstractButton> getElements() { return buttons.elements(); }
*** 150,164 **** public ButtonModel getSelection() { return selection; } /** ! * Sets the selected value for the <code>ButtonModel</code>. * Only one button in the group may be selected at a time. ! * @param m the <code>ButtonModel</code> ! * @param b <code>true</code> if this button is to be ! * selected, otherwise <code>false</code> */ public void setSelected(ButtonModel m, boolean b) { if (b && m != null && m != selection) { ButtonModel oldSelection = selection; selection = m; --- 150,164 ---- public ButtonModel getSelection() { return selection; } /** ! * Sets the selected value for the {@code ButtonModel}. * Only one button in the group may be selected at a time. ! * @param m the {@code ButtonModel} ! * @param b {@code true} if this button is to be ! * selected, otherwise {@code false} */ public void setSelected(ButtonModel m, boolean b) { if (b && m != null && m != selection) { ButtonModel oldSelection = selection; selection = m;
< prev index next >