-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.3.0
-
sparc
-
solaris_2.5, solaris_2.6
PropertyChangeListener, AncestorListener, VetoableChangeListener
For the following test program, getListeners() will always return 0 no matter how many listeners you add to the component.
----------------------------------- Cut Here ----------------------------------
import java.beans.*;
import java.util.*;
import javax.swing.*;
import javax.swing.event.*;
public class TestGetListenersForJComponent
implements PropertyChangeListener, AncestorListener, VetoableChangeListener {
JToolTip aComp = new JToolTip();
EventListener[] eventListener;
public TestGetListenersForJComponent() {
eventListener = aComp.getListeners(PropertyChangeListener.class);
System.out.println("PropertyChangeListener before adding a listener: " + eventListener.length);
eventListener = aComp.getListeners(AncestorListener.class);
System.out.println("AncestorListener before adding a listener: " + eventListener.length);
eventListener = aComp.getListeners(VetoableChangeListener.class);
System.out.println("VetoableChangeListener before adding a listener: " + eventListener.length);
aComp.addPropertyChangeListener(this);
aComp.addAncestorListener(this);
aComp.addVetoableChangeListener(this);
System.out.println("");
eventListener = aComp.getListeners(PropertyChangeListener.class);
System.out.println("PropertyChangeListener after adding a listener: " + eventListener.length);
eventListener = aComp.getListeners(AncestorListener.class);
System.out.println("AncestorListener after adding a listener: " + eventListener.length);
eventListener = aComp.getListeners(VetoableChangeListener.class);
System.out.println("VetoableChangeListener after adding a listener: " + eventListener.length);
}
public void propertyChange(PropertyChangeEvent e) {}
public void ancestorAdded(AncestorEvent e) {}
public void ancestorMoved(AncestorEvent event) {}
public void ancestorRemoved(AncestorEvent event) {}
public void vetoableChange(PropertyChangeEvent evt) {}
public static void main(String[] args) {
new TestGetListenersForJComponent();
}
}
----------------------------------- Cut Here -----------------------------------
edmund.lou@eng 1999-07-27
JFC SQE
- duplicates
-
JDK-4257560 Component: getListeners() returning incorrect value.
-
- Closed
-
-
JDK-4257562 Container: getListeners() returning incorrect value.
-
- Closed
-
-
JDK-4257589 Scrollbar: getListeners() returning incorrect value.
-
- Closed
-
-
JDK-4257591 Checkbox: getListeners() returning incorrect value.
-
- Closed
-
-
JDK-4257592 Window: getListeners() returning incorrect value.
-
- Closed
-
-
JDK-4257593 List: getListeners() returning incorrect value.
-
- Closed
-
-
JDK-4257596 TextComponent: getListeners() returning incorrect value.
-
- Closed
-
-
JDK-4257597 Choice: getListeners() returning incorrect value.
-
- Closed
-
-
JDK-4257600 TextField: getListeners() returning incorrect value.
-
- Closed
-
-
JDK-4257604 Button: getListeners() returning incorrect value.
-
- Closed
-
-
JDK-4270563 java.awt.Component.getListeners works wrong with PropertyChangeListener
-
- Closed
-
-
JDK-4257555 DefaultTreeSelectionModel: getListeners() returning incorrect value.
-
- Closed
-
-
JDK-4271266 DefaultTreeSelectionModel: getListeners() returning incorrect value.
-
- Closed
-
-
JDK-4290704 getListener Project Completion
-
- Closed
-
- relates to
-
JDK-4339918 getListeners() returns incorrect value
-
- Closed
-