-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.3.0
-
sparc
-
solaris_2.6
The getListeners() implemented at DefaultTreeSelectionModel level doesn't return the correct value for PropertyChangeListener.
For the following program, getListeners() always returns 0 no matter how many PropertyChangeListeners you add to the component.
------------------------------------ Cut Here ---------------------------------
import javax.swing.tree.*;
import java.beans.*;
import java.util.*;
public class TestGetListenersForDefaultTreeSelectionModel
implements PropertyChangeListener{
DefaultTreeSelectionModel aComp = new DefaultTreeSelectionModel();
EventListener[] eventListener;
public TestGetListenersForDefaultTreeSelectionModel() {
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 TestGetListenersForDefaultTreeSelectionModel();
}
}
----------------------------------- Cut Here ----------------------------------
edmund.lou@eng 1999-07-27
JFC SQE
For the following program, getListeners() always returns 0 no matter how many PropertyChangeListeners you add to the component.
------------------------------------ Cut Here ---------------------------------
import javax.swing.tree.*;
import java.beans.*;
import java.util.*;
public class TestGetListenersForDefaultTreeSelectionModel
implements PropertyChangeListener{
DefaultTreeSelectionModel aComp = new DefaultTreeSelectionModel();
EventListener[] eventListener;
public TestGetListenersForDefaultTreeSelectionModel() {
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 TestGetListenersForDefaultTreeSelectionModel();
}
}
----------------------------------- Cut Here ----------------------------------
edmund.lou@eng 1999-07-27
JFC SQE
- duplicates
-
JDK-4257538 JComponent: getListeners() returning incorrect values for listeners.
-
- Closed
-