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; /**
*** 3706,3752 **** c.getAccessibleContext(), null); } } } - /** - * Fire PropertyChange listener, if one is registered, - * when focus events happen - * @since 1.3 - */ - protected class AccessibleFocusHandler implements FocusListener { - public void focusGained(FocusEvent event) { - if (accessibleContext != null) { - accessibleContext.firePropertyChange( - AccessibleContext.ACCESSIBLE_STATE_PROPERTY, - null, AccessibleState.FOCUSED); - } - } - public void focusLost(FocusEvent event) { - if (accessibleContext != null) { - accessibleContext.firePropertyChange( - AccessibleContext.ACCESSIBLE_STATE_PROPERTY, - AccessibleState.FOCUSED, null); - } - } - } // inner class AccessibleFocusHandler - /** * 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); } --- 3706,3726 ----
*** 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); } --- 3731,3740 ----