|
Quick Lists
|
|
Bug ID:
|
4257538
|
|
Votes
|
0
|
|
Synopsis
|
JComponent: getListeners() returning incorrect values for listeners.
|
|
Category
|
java:classes_awt
|
|
Reported Against
|
kestrel
, kestrel-beta
|
|
Release Fixed
|
|
|
State
|
11-Closed, duplicate of 4290704,
bug
|
|
Priority:
|
4-Low
|
|
Related Bugs
|
4257589
,
4257591
,
4257592
,
4257593
,
4257596
,
4257597
,
4257600
,
4257604
,
4257555
,
4257560
,
4257562
,
4270563
,
4271266
,
4290704
,
4339918
|
|
Submit Date
|
27-JUL-1999
|
|
Description
|
The implementation of getListeners() for JComponent is broken for the following listeners:
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 -----------------------------------
xxxxx@xxxxx 1999-07-27
JFC SQE
|
|
Work Around
|
N/A
|
|
Evaluation
|
This is not a regression. This behavior is not implemented in Kestrel
which is the first release to include any public facilities for the
retrieval of listeners. Support for property change listeners which
are handled differently by the current implementation will be included
in a future release.
Bugid 4290704 was filed for the completion of this project.
xxxxx@xxxxx 2000-02-16
|
|
Comments
|
Submitted On 13-OCT-2000
dBeurton
Is this bug related to the fact that under
Netscape/RedHat6.1, the swing buttons and text area do no
respond?
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |