-
Bug
-
Resolution: Duplicate
-
P2
-
None
-
1.3.0
-
sparc
-
solaris_2.6
TextField implementation of getListeners() returns incorrect value for PropertyChangeListener.
getListeners() in the following program returns 0 for PropertyChangeListner all the time no matter how many PropertyChangeListeners you add.
--------------------------------- Cut Here -------------------------------------
import java.awt.*;
import java.beans.*;
import java.util.*;
public class TestGetListenersForTextField
implements PropertyChangeListener{
TextField aComp = new TextField();
EventListener[] eventListener;
public TestGetListenersForTextField() {
eventListener = aComp.getListeners(PropertyChangeListener.class);
System.out.println("Before adding a listener: " + eventListener.length);
aComp.addPropertyChangeListener(this);
eventListener = aComp.getListeners(PropertyChangeListener.class);
System.out.println("After adding a listener: " + eventListener.length);
}
public void propertyChange(PropertyChangeEvent e) {}
public static void main(String[] args) {
new TestGetListenersForTextField();
}
}
--------------------------------- Cut Here -------------------------------------
edmund.lou@eng 1999-07-27
JFC SQE
getListeners() in the following program returns 0 for PropertyChangeListner all the time no matter how many PropertyChangeListeners you add.
--------------------------------- Cut Here -------------------------------------
import java.awt.*;
import java.beans.*;
import java.util.*;
public class TestGetListenersForTextField
implements PropertyChangeListener{
TextField aComp = new TextField();
EventListener[] eventListener;
public TestGetListenersForTextField() {
eventListener = aComp.getListeners(PropertyChangeListener.class);
System.out.println("Before adding a listener: " + eventListener.length);
aComp.addPropertyChangeListener(this);
eventListener = aComp.getListeners(PropertyChangeListener.class);
System.out.println("After adding a listener: " + eventListener.length);
}
public void propertyChange(PropertyChangeEvent e) {}
public static void main(String[] args) {
new TestGetListenersForTextField();
}
}
--------------------------------- Cut Here -------------------------------------
edmund.lou@eng 1999-07-27
JFC SQE
- duplicates
-
JDK-4257538 JComponent: getListeners() returning incorrect values for listeners.
-
- Closed
-