8009883: REGRESSION: test/closed/javax/swing/AbstractButton/4246045/bug4246045.java fails
Summary: remove redundant focus handler that was causing a second focus event
Reviewed-by: alexsch, pchelko
Contributed-by: peter.brunet@oracle.com
--- a/jdk/src/share/classes/javax/swing/JComponent.java Mon May 26 15:50:10 2014 +0400
+++ b/jdk/src/share/classes/javax/swing/JComponent.java Mon May 26 16:37:25 2014 +0400
@@ -3679,8 +3679,8 @@
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;
@@ -3738,14 +3738,10 @@
* @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);
@@ -3760,7 +3756,6 @@
*/
public void removePropertyChangeListener(PropertyChangeListener listener) {
if (--propertyListenersCount == 0) {
- JComponent.this.removeFocusListener(accessibleFocusHandler);
JComponent.this.removeContainerListener(accessibleContainerHandler);
}
super.removePropertyChangeListener(listener);