< prev index next >

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

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


  45  * <p>
  46  * Buttons can be configured, and to some degree controlled, by
  47  * <code><a href="Action.html">Action</a></code>s.  Using an
  48  * <code>Action</code> with a button has many benefits beyond directly
  49  * configuring a button.  Refer to <a href="Action.html#buttonActions">
  50  * Swing Components Supporting <code>Action</code></a> for more
  51  * details, and you can find more information in <a
  52  * href="https://docs.oracle.com/javase/tutorial/uiswing/misc/action.html">How
  53  * to Use Actions</a>, a section in <em>The Java Tutorial</em>.
  54  * <p>
  55  * For further information see
  56  * <a
  57  href="https://docs.oracle.com/javase/tutorial/uiswing/components/button.html">How to Use Buttons, Check Boxes, and Radio Buttons</a>,
  58  * a section in <em>The Java Tutorial</em>.
  59  * <p>
  60  * <strong>Warning:</strong>
  61  * Serialized objects of this class will not be compatible with
  62  * future Swing releases. The current serialization support is
  63  * appropriate for short term storage or RMI between applications running
  64  * the same version of Swing.  As of 1.4, support for long term storage
  65  * of all JavaBeans&trade;
  66  * has been added to the <code>java.beans</code> package.
  67  * Please see {@link java.beans.XMLEncoder}.
  68  *
  69  * @author Jeff Dinkins
  70  * @since 1.2
  71  */
  72 @JavaBean(defaultProperty = "UI")
  73 @SuppressWarnings("serial") // Same-version serialization only
  74 public abstract class AbstractButton extends JComponent implements ItemSelectable, SwingConstants {
  75 
  76     // *********************************
  77     // ******* Button properties *******
  78     // *********************************
  79 
  80     /** Identifies a change in the button model. */
  81     public static final String MODEL_CHANGED_PROPERTY = "model";
  82     /** Identifies a change in the button's text. */
  83     public static final String TEXT_CHANGED_PROPERTY = "text";
  84     /** Identifies a change to the button's mnemonic. */
  85     public static final String MNEMONIC_CHANGED_PROPERTY = "mnemonic";


1901 
1902     /**
1903      * Subclasses that want to handle <code>ChangeEvents</code> differently
1904      * can override this to return another <code>ChangeListener</code>
1905      * implementation.
1906      *
1907      * @return the new <code>ChangeListener</code>
1908      */
1909     protected ChangeListener createChangeListener() {
1910         return getHandler();
1911     }
1912 
1913     /**
1914      * Extends <code>ChangeListener</code> to be serializable.
1915      * <p>
1916      * <strong>Warning:</strong>
1917      * Serialized objects of this class will not be compatible with
1918      * future Swing releases. The current serialization support is
1919      * appropriate for short term storage or RMI between applications running
1920      * the same version of Swing.  As of 1.4, support for long term storage
1921      * of all JavaBeans&trade;
1922      * has been added to the <code>java.beans</code> package.
1923      * Please see {@link java.beans.XMLEncoder}.
1924      */
1925     @SuppressWarnings("serial")
1926     protected class ButtonChangeListener implements ChangeListener, Serializable {
1927         // NOTE: This class is NOT used, instead the functionality has
1928         // been moved to Handler.
1929         ButtonChangeListener() {
1930         }
1931 
1932         public void stateChanged(ChangeEvent e) {
1933             getHandler().stateChanged(e);
1934         }
1935     }
1936 
1937 
1938     /**
1939      * Notifies all listeners that have registered interest for
1940      * notification on this event type.  The event instance
1941      * is lazily created using the <code>event</code>


2324                     }
2325                 }
2326             }
2327         }
2328     }
2329 
2330 ///////////////////
2331 // Accessibility support
2332 ///////////////////
2333     /**
2334      * This class implements accessibility support for the
2335      * <code>AbstractButton</code> class.  It provides an implementation of the
2336      * Java Accessibility API appropriate to button and menu item
2337      * user-interface elements.
2338      * <p>
2339      * <strong>Warning:</strong>
2340      * Serialized objects of this class will not be compatible with
2341      * future Swing releases. The current serialization support is
2342      * appropriate for short term storage or RMI between applications running
2343      * the same version of Swing.  As of 1.4, support for long term storage
2344      * of all JavaBeans&trade;
2345      * has been added to the <code>java.beans</code> package.
2346      * Please see {@link java.beans.XMLEncoder}.
2347      * @since 1.4
2348      */
2349     @SuppressWarnings("serial") // Same-version serialization only
2350     protected abstract class AccessibleAbstractButton
2351         extends AccessibleJComponent implements AccessibleAction,
2352         AccessibleValue, AccessibleText, AccessibleExtendedComponent {
2353 
2354         /**
2355          * Returns the accessible name of this object.
2356          *
2357          * @return the localized name of the object -- can be
2358          *              <code>null</code> if this
2359          *              object does not have a name
2360          */
2361         public String getAccessibleName() {
2362             String name = accessibleName;
2363 
2364             if (name == null) {




  45  * <p>
  46  * Buttons can be configured, and to some degree controlled, by
  47  * <code><a href="Action.html">Action</a></code>s.  Using an
  48  * <code>Action</code> with a button has many benefits beyond directly
  49  * configuring a button.  Refer to <a href="Action.html#buttonActions">
  50  * Swing Components Supporting <code>Action</code></a> for more
  51  * details, and you can find more information in <a
  52  * href="https://docs.oracle.com/javase/tutorial/uiswing/misc/action.html">How
  53  * to Use Actions</a>, a section in <em>The Java Tutorial</em>.
  54  * <p>
  55  * For further information see
  56  * <a
  57  href="https://docs.oracle.com/javase/tutorial/uiswing/components/button.html">How to Use Buttons, Check Boxes, and Radio Buttons</a>,
  58  * a section in <em>The Java Tutorial</em>.
  59  * <p>
  60  * <strong>Warning:</strong>
  61  * Serialized objects of this class will not be compatible with
  62  * future Swing releases. The current serialization support is
  63  * appropriate for short term storage or RMI between applications running
  64  * the same version of Swing.  As of 1.4, support for long term storage
  65  * of all JavaBeans
  66  * has been added to the <code>java.beans</code> package.
  67  * Please see {@link java.beans.XMLEncoder}.
  68  *
  69  * @author Jeff Dinkins
  70  * @since 1.2
  71  */
  72 @JavaBean(defaultProperty = "UI")
  73 @SuppressWarnings("serial") // Same-version serialization only
  74 public abstract class AbstractButton extends JComponent implements ItemSelectable, SwingConstants {
  75 
  76     // *********************************
  77     // ******* Button properties *******
  78     // *********************************
  79 
  80     /** Identifies a change in the button model. */
  81     public static final String MODEL_CHANGED_PROPERTY = "model";
  82     /** Identifies a change in the button's text. */
  83     public static final String TEXT_CHANGED_PROPERTY = "text";
  84     /** Identifies a change to the button's mnemonic. */
  85     public static final String MNEMONIC_CHANGED_PROPERTY = "mnemonic";


1901 
1902     /**
1903      * Subclasses that want to handle <code>ChangeEvents</code> differently
1904      * can override this to return another <code>ChangeListener</code>
1905      * implementation.
1906      *
1907      * @return the new <code>ChangeListener</code>
1908      */
1909     protected ChangeListener createChangeListener() {
1910         return getHandler();
1911     }
1912 
1913     /**
1914      * Extends <code>ChangeListener</code> to be serializable.
1915      * <p>
1916      * <strong>Warning:</strong>
1917      * Serialized objects of this class will not be compatible with
1918      * future Swing releases. The current serialization support is
1919      * appropriate for short term storage or RMI between applications running
1920      * the same version of Swing.  As of 1.4, support for long term storage
1921      * of all JavaBeans
1922      * has been added to the <code>java.beans</code> package.
1923      * Please see {@link java.beans.XMLEncoder}.
1924      */
1925     @SuppressWarnings("serial")
1926     protected class ButtonChangeListener implements ChangeListener, Serializable {
1927         // NOTE: This class is NOT used, instead the functionality has
1928         // been moved to Handler.
1929         ButtonChangeListener() {
1930         }
1931 
1932         public void stateChanged(ChangeEvent e) {
1933             getHandler().stateChanged(e);
1934         }
1935     }
1936 
1937 
1938     /**
1939      * Notifies all listeners that have registered interest for
1940      * notification on this event type.  The event instance
1941      * is lazily created using the <code>event</code>


2324                     }
2325                 }
2326             }
2327         }
2328     }
2329 
2330 ///////////////////
2331 // Accessibility support
2332 ///////////////////
2333     /**
2334      * This class implements accessibility support for the
2335      * <code>AbstractButton</code> class.  It provides an implementation of the
2336      * Java Accessibility API appropriate to button and menu item
2337      * user-interface elements.
2338      * <p>
2339      * <strong>Warning:</strong>
2340      * Serialized objects of this class will not be compatible with
2341      * future Swing releases. The current serialization support is
2342      * appropriate for short term storage or RMI between applications running
2343      * the same version of Swing.  As of 1.4, support for long term storage
2344      * of all JavaBeans
2345      * has been added to the <code>java.beans</code> package.
2346      * Please see {@link java.beans.XMLEncoder}.
2347      * @since 1.4
2348      */
2349     @SuppressWarnings("serial") // Same-version serialization only
2350     protected abstract class AccessibleAbstractButton
2351         extends AccessibleJComponent implements AccessibleAction,
2352         AccessibleValue, AccessibleText, AccessibleExtendedComponent {
2353 
2354         /**
2355          * Returns the accessible name of this object.
2356          *
2357          * @return the localized name of the object -- can be
2358          *              <code>null</code> if this
2359          *              object does not have a name
2360          */
2361         public String getAccessibleName() {
2362             String name = accessibleName;
2363 
2364             if (name == null) {


< prev index next >