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

Print this page

        

*** 3676,3687 **** * 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. */ @Deprecated protected FocusListener accessibleFocusHandler = null; /** --- 3676,3687 ---- * target JComponent's state */ private volatile transient int propertyListenersCount = 0; /** ! * 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,3752 **** * 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(); } if (accessibleContainerHandler == null) { accessibleContainerHandler = new AccessibleContainerHandler(); } if (propertyListenersCount++ == 0) { ! JComponent.this.addFocusListener(accessibleFocusHandler); JComponent.this.addContainerListener(accessibleContainerHandler); } super.addPropertyChangeListener(listener); } --- 3735,3754 ---- * Adds a PropertyChangeListener to the listener list. * * @param listener the PropertyChangeListener to be added */ public void addPropertyChangeListener(PropertyChangeListener listener) { ! // 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(accessibleAWTFocusHandler); JComponent.this.addContainerListener(accessibleContainerHandler); } super.addPropertyChangeListener(listener); }
*** 3757,3767 **** * * @param listener the PropertyChangeListener to be removed */ public void removePropertyChangeListener(PropertyChangeListener listener) { if (--propertyListenersCount == 0) { ! JComponent.this.removeFocusListener(accessibleFocusHandler); JComponent.this.removeContainerListener(accessibleContainerHandler); } super.removePropertyChangeListener(listener); } --- 3759,3771 ---- * * @param listener the PropertyChangeListener to be removed */ public void removePropertyChangeListener(PropertyChangeListener listener) { if (--propertyListenersCount == 0) { ! // 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); }