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

Print this page

        

@@ -3676,12 +3676,12 @@
          * target JComponent's state
          */
         private volatile transient int propertyListenersCount = 0;
 
         /**
-         * This field duplicates the one in java.awt.Component.AccessibleAWTComponent,
-         * so it has been deprecated.
+         * This field duplicates the function of the accessibleAWTFocusHandler field
+         * in java.awt.Component.AccessibleAWTComponent, so it has been deprecated.
          */
         @Deprecated
         protected FocusListener accessibleFocusHandler = null;
 
         /**

@@ -3735,18 +3735,20 @@
          * Adds a PropertyChangeListener to the listener list.
          *
          * @param listener  the PropertyChangeListener to be added
          */
         public void addPropertyChangeListener(PropertyChangeListener listener) {
-            if (accessibleFocusHandler == null) {
-                accessibleFocusHandler = new AccessibleFocusHandler();
+            // Due to JDK-7179482 the accessibleFocusHandler field in this class
+            // is deprecated and need to use accessibleAWTFocusHandler in superclass.
+            if (accessibleAWTFocusHandler == null) {
+                accessibleAWTFocusHandler = new AccessibleFocusHandler();
             }
             if (accessibleContainerHandler == null) {
                 accessibleContainerHandler = new AccessibleContainerHandler();
             }
             if (propertyListenersCount++ == 0) {
-                JComponent.this.addFocusListener(accessibleFocusHandler);
+                JComponent.this.addFocusListener(accessibleAWTFocusHandler);
                 JComponent.this.addContainerListener(accessibleContainerHandler);
             }
             super.addPropertyChangeListener(listener);
         }
 

@@ -3757,11 +3759,13 @@
          *
          * @param listener  the PropertyChangeListener to be removed
          */
         public void removePropertyChangeListener(PropertyChangeListener listener) {
             if (--propertyListenersCount == 0) {
-                JComponent.this.removeFocusListener(accessibleFocusHandler);
+                // Due to JDK-7179482 the accessibleFocusHandler field in this class
+                // is deprecated and need to use accessibleAWTFocusHandler in superclass.
+                JComponent.this.removeFocusListener(accessibleAWTFocusHandler);
                 JComponent.this.removeContainerListener(accessibleContainerHandler);
             }
             super.removePropertyChangeListener(listener);
         }