< prev index next >

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

Print this page
rev 60127 : 8249205: Remove unnecessary trademark symbols


  47  * <p>
  48  * Buttons can be configured, and to some degree controlled, by
  49  * <code><a href="Action.html">Action</a></code>s.  Using an
  50  * <code>Action</code> with a button has many benefits beyond directly
  51  * configuring a button.  Refer to <a href="Action.html#buttonActions">
  52  * Swing Components Supporting <code>Action</code></a> for more
  53  * details, and you can find more information in <a
  54  * href="https://docs.oracle.com/javase/tutorial/uiswing/misc/action.html">How
  55  * to Use Actions</a>, a section in <em>The Java Tutorial</em>.
  56  * <p>
  57  * <strong>Warning:</strong> Swing is not thread safe. For more
  58  * information see <a
  59  * href="package-summary.html#threading">Swing's Threading
  60  * Policy</a>.
  61  * <p>
  62  * <strong>Warning:</strong>
  63  * Serialized objects of this class will not be compatible with
  64  * future Swing releases. The current serialization support is
  65  * appropriate for short term storage or RMI between applications running
  66  * the same version of Swing.  As of 1.4, support for long term storage
  67  * of all JavaBeans&trade;
  68  * has been added to the <code>java.beans</code> package.
  69  * Please see {@link java.beans.XMLEncoder}.
  70  *
  71  * @see JRadioButton
  72  * @see JCheckBox
  73  * @author Jeff Dinkins
  74  * @since 1.2
  75  */
  76 @JavaBean(defaultProperty = "UIClassID", description = "An implementation of a two-state button.")
  77 @SwingContainer(false)
  78 @SuppressWarnings("serial") // Same-version serialization only
  79 public class JToggleButton extends AbstractButton implements Accessible {
  80 
  81     /**
  82      * @see #getUIClassID
  83      * @see #readObject
  84      */
  85     private static final String uiClassID = "ToggleButtonUI";
  86 
  87     /**


 292      */
 293     public boolean requestFocusInWindow(FocusEvent.Cause cause) {
 294         return getGroupSelection(cause)
 295                                     .requestFocusInWindowUnconditionally(cause);
 296     }
 297 
 298     private boolean requestFocusInWindowUnconditionally(FocusEvent.Cause cause) {
 299         return super.requestFocusInWindow(cause);
 300     }
 301 
 302     // *********************************************************************
 303 
 304     /**
 305      * The ToggleButton model
 306      * <p>
 307      * <strong>Warning:</strong>
 308      * Serialized objects of this class will not be compatible with
 309      * future Swing releases. The current serialization support is
 310      * appropriate for short term storage or RMI between applications running
 311      * the same version of Swing.  As of 1.4, support for long term storage
 312      * of all JavaBeans&trade;
 313      * has been added to the <code>java.beans</code> package.
 314      * Please see {@link java.beans.XMLEncoder}.
 315      */
 316     @SuppressWarnings("serial") // Same-version serialization only
 317     public static class ToggleButtonModel extends DefaultButtonModel {
 318 
 319         /**
 320          * Creates a new ToggleButton Model
 321          */
 322         public ToggleButtonModel () {
 323         }
 324 
 325         /**
 326          * Checks if the button is selected.
 327          */
 328         public boolean isSelected() {
 329 //              if(getGroup() != null) {
 330 //                  return getGroup().isSelected(this);
 331 //              } else {
 332                 return (stateMask & SELECTED) != 0;


 455     @BeanProperty(bound = false, expert = true, description
 456             = "The AccessibleContext associated with this ToggleButton.")
 457     public AccessibleContext getAccessibleContext() {
 458         if (accessibleContext == null) {
 459             accessibleContext = new AccessibleJToggleButton();
 460         }
 461         return accessibleContext;
 462     }
 463 
 464     /**
 465      * This class implements accessibility support for the
 466      * <code>JToggleButton</code> class.  It provides an implementation of the
 467      * Java Accessibility API appropriate to toggle button user-interface
 468      * elements.
 469      * <p>
 470      * <strong>Warning:</strong>
 471      * Serialized objects of this class will not be compatible with
 472      * future Swing releases. The current serialization support is
 473      * appropriate for short term storage or RMI between applications running
 474      * the same version of Swing.  As of 1.4, support for long term storage
 475      * of all JavaBeans&trade;
 476      * has been added to the <code>java.beans</code> package.
 477      * Please see {@link java.beans.XMLEncoder}.
 478      */
 479     @SuppressWarnings("serial") // Same-version serialization only
 480     protected class AccessibleJToggleButton extends AccessibleAbstractButton
 481             implements ItemListener {
 482 
 483         /**
 484          * Constructs {@code AccessibleJToggleButton}
 485          */
 486         public AccessibleJToggleButton() {
 487             super();
 488             JToggleButton.this.addItemListener(this);
 489         }
 490 
 491         /**
 492          * Fire accessible property change events when the state of the
 493          * toggle button changes.
 494          */
 495         public void itemStateChanged(ItemEvent e) {




  47  * <p>
  48  * Buttons can be configured, and to some degree controlled, by
  49  * <code><a href="Action.html">Action</a></code>s.  Using an
  50  * <code>Action</code> with a button has many benefits beyond directly
  51  * configuring a button.  Refer to <a href="Action.html#buttonActions">
  52  * Swing Components Supporting <code>Action</code></a> for more
  53  * details, and you can find more information in <a
  54  * href="https://docs.oracle.com/javase/tutorial/uiswing/misc/action.html">How
  55  * to Use Actions</a>, a section in <em>The Java Tutorial</em>.
  56  * <p>
  57  * <strong>Warning:</strong> Swing is not thread safe. For more
  58  * information see <a
  59  * href="package-summary.html#threading">Swing's Threading
  60  * Policy</a>.
  61  * <p>
  62  * <strong>Warning:</strong>
  63  * Serialized objects of this class will not be compatible with
  64  * future Swing releases. The current serialization support is
  65  * appropriate for short term storage or RMI between applications running
  66  * the same version of Swing.  As of 1.4, support for long term storage
  67  * of all JavaBeans
  68  * has been added to the <code>java.beans</code> package.
  69  * Please see {@link java.beans.XMLEncoder}.
  70  *
  71  * @see JRadioButton
  72  * @see JCheckBox
  73  * @author Jeff Dinkins
  74  * @since 1.2
  75  */
  76 @JavaBean(defaultProperty = "UIClassID", description = "An implementation of a two-state button.")
  77 @SwingContainer(false)
  78 @SuppressWarnings("serial") // Same-version serialization only
  79 public class JToggleButton extends AbstractButton implements Accessible {
  80 
  81     /**
  82      * @see #getUIClassID
  83      * @see #readObject
  84      */
  85     private static final String uiClassID = "ToggleButtonUI";
  86 
  87     /**


 292      */
 293     public boolean requestFocusInWindow(FocusEvent.Cause cause) {
 294         return getGroupSelection(cause)
 295                                     .requestFocusInWindowUnconditionally(cause);
 296     }
 297 
 298     private boolean requestFocusInWindowUnconditionally(FocusEvent.Cause cause) {
 299         return super.requestFocusInWindow(cause);
 300     }
 301 
 302     // *********************************************************************
 303 
 304     /**
 305      * The ToggleButton model
 306      * <p>
 307      * <strong>Warning:</strong>
 308      * Serialized objects of this class will not be compatible with
 309      * future Swing releases. The current serialization support is
 310      * appropriate for short term storage or RMI between applications running
 311      * the same version of Swing.  As of 1.4, support for long term storage
 312      * of all JavaBeans
 313      * has been added to the <code>java.beans</code> package.
 314      * Please see {@link java.beans.XMLEncoder}.
 315      */
 316     @SuppressWarnings("serial") // Same-version serialization only
 317     public static class ToggleButtonModel extends DefaultButtonModel {
 318 
 319         /**
 320          * Creates a new ToggleButton Model
 321          */
 322         public ToggleButtonModel () {
 323         }
 324 
 325         /**
 326          * Checks if the button is selected.
 327          */
 328         public boolean isSelected() {
 329 //              if(getGroup() != null) {
 330 //                  return getGroup().isSelected(this);
 331 //              } else {
 332                 return (stateMask & SELECTED) != 0;


 455     @BeanProperty(bound = false, expert = true, description
 456             = "The AccessibleContext associated with this ToggleButton.")
 457     public AccessibleContext getAccessibleContext() {
 458         if (accessibleContext == null) {
 459             accessibleContext = new AccessibleJToggleButton();
 460         }
 461         return accessibleContext;
 462     }
 463 
 464     /**
 465      * This class implements accessibility support for the
 466      * <code>JToggleButton</code> class.  It provides an implementation of the
 467      * Java Accessibility API appropriate to toggle button user-interface
 468      * elements.
 469      * <p>
 470      * <strong>Warning:</strong>
 471      * Serialized objects of this class will not be compatible with
 472      * future Swing releases. The current serialization support is
 473      * appropriate for short term storage or RMI between applications running
 474      * the same version of Swing.  As of 1.4, support for long term storage
 475      * of all JavaBeans
 476      * has been added to the <code>java.beans</code> package.
 477      * Please see {@link java.beans.XMLEncoder}.
 478      */
 479     @SuppressWarnings("serial") // Same-version serialization only
 480     protected class AccessibleJToggleButton extends AccessibleAbstractButton
 481             implements ItemListener {
 482 
 483         /**
 484          * Constructs {@code AccessibleJToggleButton}
 485          */
 486         public AccessibleJToggleButton() {
 487             super();
 488             JToggleButton.this.addItemListener(this);
 489         }
 490 
 491         /**
 492          * Fire accessible property change events when the state of the
 493          * toggle button changes.
 494          */
 495         public void itemStateChanged(ItemEvent e) {


< prev index next >