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

Print this page


   1 /*
   2  * Copyright (c) 1997, 2013, 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


 162  * Serialized objects of this class will not be compatible with
 163  * future Swing releases. The current serialization support is
 164  * appropriate for short term storage or RMI between applications running
 165  * the same version of Swing.  As of 1.4, support for long term storage
 166  * of all JavaBeans™
 167  * has been added to the <code>java.beans</code> package.
 168  * Please see {@link java.beans.XMLEncoder}.
 169  *
 170  * @see KeyStroke
 171  * @see Action
 172  * @see #setBorder
 173  * @see #registerKeyboardAction
 174  * @see JOptionPane
 175  * @see #setDebugGraphicsOptions
 176  * @see #setToolTipText
 177  * @see #setAutoscrolls
 178  *
 179  * @author Hans Muller
 180  * @author Arnaud Weber
 181  */

 182 public abstract class JComponent extends Container implements Serializable,
 183                                               TransferHandler.HasGetTransferHandler
 184 {
 185     /**
 186      * @see #getUIClassID
 187      * @see #writeObject
 188      */
 189     private static final String uiClassID = "ComponentUI";
 190 
 191     /**
 192      * @see #readObject
 193      */
 194     private static final Hashtable<ObjectInputStream, ReadObjectCallback> readObjectCallbacks =
 195             new Hashtable<ObjectInputStream, ReadObjectCallback>(1);
 196 
 197     /**
 198      * Keys to use for forward focus traversal when the JComponent is
 199      * managing focus.
 200      */
 201     private static Set<KeyStroke> managingFocusForwardTraversalKeys;


3640                     AccessibleState.ENABLED, null);
3641             }
3642         }
3643     }
3644 
3645     /**
3646      * Inner class of JComponent used to provide default support for
3647      * accessibility.  This class is not meant to be used directly by
3648      * application developers, but is instead meant only to be
3649      * subclassed by component developers.
3650      * <p>
3651      * <strong>Warning:</strong>
3652      * Serialized objects of this class will not be compatible with
3653      * future Swing releases. The current serialization support is
3654      * appropriate for short term storage or RMI between applications running
3655      * the same version of Swing.  As of 1.4, support for long term storage
3656      * of all JavaBeans&trade;
3657      * has been added to the <code>java.beans</code> package.
3658      * Please see {@link java.beans.XMLEncoder}.
3659      */

3660     public abstract class AccessibleJComponent extends AccessibleAWTContainer
3661        implements AccessibleExtendedComponent
3662     {
3663         /**
3664          * Though the class is abstract, this should be called by
3665          * all sub-classes.
3666          */
3667         protected AccessibleJComponent() {
3668             super();
3669         }
3670 
3671         /**
3672          * Number of PropertyChangeListener objects registered. It's used
3673          * to add/remove ContainerListener and FocusListener to track
3674          * target JComponent's state
3675          */
3676         private volatile transient int propertyListenersCount = 0;
3677 
3678         /**
3679          * This field duplicates the one in java.awt.Component.AccessibleAWTComponent,


   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


 162  * Serialized objects of this class will not be compatible with
 163  * future Swing releases. The current serialization support is
 164  * appropriate for short term storage or RMI between applications running
 165  * the same version of Swing.  As of 1.4, support for long term storage
 166  * of all JavaBeans&trade;
 167  * has been added to the <code>java.beans</code> package.
 168  * Please see {@link java.beans.XMLEncoder}.
 169  *
 170  * @see KeyStroke
 171  * @see Action
 172  * @see #setBorder
 173  * @see #registerKeyboardAction
 174  * @see JOptionPane
 175  * @see #setDebugGraphicsOptions
 176  * @see #setToolTipText
 177  * @see #setAutoscrolls
 178  *
 179  * @author Hans Muller
 180  * @author Arnaud Weber
 181  */
 182 @SuppressWarnings("serial") // Same-version serialization only
 183 public abstract class JComponent extends Container implements Serializable,
 184                                               TransferHandler.HasGetTransferHandler
 185 {
 186     /**
 187      * @see #getUIClassID
 188      * @see #writeObject
 189      */
 190     private static final String uiClassID = "ComponentUI";
 191 
 192     /**
 193      * @see #readObject
 194      */
 195     private static final Hashtable<ObjectInputStream, ReadObjectCallback> readObjectCallbacks =
 196             new Hashtable<ObjectInputStream, ReadObjectCallback>(1);
 197 
 198     /**
 199      * Keys to use for forward focus traversal when the JComponent is
 200      * managing focus.
 201      */
 202     private static Set<KeyStroke> managingFocusForwardTraversalKeys;


3641                     AccessibleState.ENABLED, null);
3642             }
3643         }
3644     }
3645 
3646     /**
3647      * Inner class of JComponent used to provide default support for
3648      * accessibility.  This class is not meant to be used directly by
3649      * application developers, but is instead meant only to be
3650      * subclassed by component developers.
3651      * <p>
3652      * <strong>Warning:</strong>
3653      * Serialized objects of this class will not be compatible with
3654      * future Swing releases. The current serialization support is
3655      * appropriate for short term storage or RMI between applications running
3656      * the same version of Swing.  As of 1.4, support for long term storage
3657      * of all JavaBeans&trade;
3658      * has been added to the <code>java.beans</code> package.
3659      * Please see {@link java.beans.XMLEncoder}.
3660      */
3661     @SuppressWarnings("serial") // Same-version serialization only
3662     public abstract class AccessibleJComponent extends AccessibleAWTContainer
3663        implements AccessibleExtendedComponent
3664     {
3665         /**
3666          * Though the class is abstract, this should be called by
3667          * all sub-classes.
3668          */
3669         protected AccessibleJComponent() {
3670             super();
3671         }
3672 
3673         /**
3674          * Number of PropertyChangeListener objects registered. It's used
3675          * to add/remove ContainerListener and FocusListener to track
3676          * target JComponent's state
3677          */
3678         private volatile transient int propertyListenersCount = 0;
3679 
3680         /**
3681          * This field duplicates the one in java.awt.Component.AccessibleAWTComponent,