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

Print this page


   1 /*
   2  * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  69  * href="package-summary.html#threading">Swing's Threading
  70  * Policy</a>.
  71  * <p>
  72  * <strong>Warning:</strong>
  73  * Serialized objects of this class will not be compatible with
  74  * future Swing releases. The current serialization support is
  75  * appropriate for short term storage or RMI between applications running
  76  * the same version of Swing.  As of 1.4, support for long term storage
  77  * of all JavaBeans&trade;
  78  * has been added to the <code>java.beans</code> package.
  79  * Please see {@link java.beans.XMLEncoder}.
  80  *
  81  * @beaninfo
  82  *   attribute: isContainer false
  83  * description: A component which can display it's state as selected or deselected.
  84  *
  85  * @see ButtonGroup
  86  * @see JCheckBox
  87  * @author Jeff Dinkins
  88  */

  89 public class JRadioButton extends JToggleButton implements Accessible {
  90 
  91     /**
  92      * @see #getUIClassID
  93      * @see #readObject
  94      */
  95     private static final String uiClassID = "RadioButtonUI";
  96 
  97 
  98     /**
  99      * Creates an initially unselected radio button
 100      * with no set text.
 101      */
 102     public JRadioButton () {
 103         this(null, null, false);
 104     }
 105 
 106     /**
 107      * Creates an initially unselected radio button
 108      * with the specified image but no text.


 267             accessibleContext = new AccessibleJRadioButton();
 268         }
 269         return accessibleContext;
 270     }
 271 
 272     /**
 273      * This class implements accessibility support for the
 274      * <code>JRadioButton</code> class.  It provides an implementation of the
 275      * Java Accessibility API appropriate to radio button
 276      * user-interface elements.
 277      * <p>
 278      * <strong>Warning:</strong>
 279      * Serialized objects of this class will not be compatible with
 280      * future Swing releases. The current serialization support is
 281      * appropriate for short term storage or RMI between applications running
 282      * the same version of Swing.  As of 1.4, support for long term storage
 283      * of all JavaBeans&trade;
 284      * has been added to the <code>java.beans</code> package.
 285      * Please see {@link java.beans.XMLEncoder}.
 286      */

 287     protected class AccessibleJRadioButton extends AccessibleJToggleButton {
 288 
 289         /**
 290          * Get the role of this object.
 291          *
 292          * @return an instance of AccessibleRole describing the role of the object
 293          * @see AccessibleRole
 294          */
 295         public AccessibleRole getAccessibleRole() {
 296             return AccessibleRole.RADIO_BUTTON;
 297         }
 298 
 299     } // inner class AccessibleJRadioButton
 300 }
   1 /*
   2  * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  69  * href="package-summary.html#threading">Swing's Threading
  70  * Policy</a>.
  71  * <p>
  72  * <strong>Warning:</strong>
  73  * Serialized objects of this class will not be compatible with
  74  * future Swing releases. The current serialization support is
  75  * appropriate for short term storage or RMI between applications running
  76  * the same version of Swing.  As of 1.4, support for long term storage
  77  * of all JavaBeans&trade;
  78  * has been added to the <code>java.beans</code> package.
  79  * Please see {@link java.beans.XMLEncoder}.
  80  *
  81  * @beaninfo
  82  *   attribute: isContainer false
  83  * description: A component which can display it's state as selected or deselected.
  84  *
  85  * @see ButtonGroup
  86  * @see JCheckBox
  87  * @author Jeff Dinkins
  88  */
  89 @SuppressWarnings("serial") // Same-version serialization only
  90 public class JRadioButton extends JToggleButton implements Accessible {
  91 
  92     /**
  93      * @see #getUIClassID
  94      * @see #readObject
  95      */
  96     private static final String uiClassID = "RadioButtonUI";
  97 
  98 
  99     /**
 100      * Creates an initially unselected radio button
 101      * with no set text.
 102      */
 103     public JRadioButton () {
 104         this(null, null, false);
 105     }
 106 
 107     /**
 108      * Creates an initially unselected radio button
 109      * with the specified image but no text.


 268             accessibleContext = new AccessibleJRadioButton();
 269         }
 270         return accessibleContext;
 271     }
 272 
 273     /**
 274      * This class implements accessibility support for the
 275      * <code>JRadioButton</code> class.  It provides an implementation of the
 276      * Java Accessibility API appropriate to radio button
 277      * user-interface elements.
 278      * <p>
 279      * <strong>Warning:</strong>
 280      * Serialized objects of this class will not be compatible with
 281      * future Swing releases. The current serialization support is
 282      * appropriate for short term storage or RMI between applications running
 283      * the same version of Swing.  As of 1.4, support for long term storage
 284      * of all JavaBeans&trade;
 285      * has been added to the <code>java.beans</code> package.
 286      * Please see {@link java.beans.XMLEncoder}.
 287      */
 288     @SuppressWarnings("serial") // Same-version serialization only
 289     protected class AccessibleJRadioButton extends AccessibleJToggleButton {
 290 
 291         /**
 292          * Get the role of this object.
 293          *
 294          * @return an instance of AccessibleRole describing the role of the object
 295          * @see AccessibleRole
 296          */
 297         public AccessibleRole getAccessibleRole() {
 298             return AccessibleRole.RADIO_BUTTON;
 299         }
 300 
 301     } // inner class AccessibleJRadioButton
 302 }