-
Bug
-
Resolution: Fixed
-
P3
-
6
-
b43
-
generic
-
generic
-
Verified
Code below illustrates that the headless implementation of Toolkit ignores addAWTEventListener method call:
========================== Test3.java ================================
import java.awt.*;
import java.awt.event.*;
public class Test3 {
public static void main( String argv[] ) {
Test3 t = new Test3();
t.go();
}
public void go() {
Toolkit t = Toolkit.getDefaultToolkit();
AWTEventListener ael = new MyAWTEventListener();
t.addAWTEventListener(ael, AWTEvent.CONTAINER_EVENT_MASK);
AWTEventListener[] outList =
t.getAWTEventListeners();
if (outList.length == 0) {
System.out.println("An empty array returned unexpectedly");
}
System.exit(0);
}
class MyAWTEventListener implements AWTEventListener {
public void eventDispatched(AWTEvent event) {}
}
}
================== output ================================
--> java -version
java version "1.6.0-ea"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-ea-b31)
Java HotSpot(TM) Client VM (build 1.6.0-ea-b31, mixed mode)
--> java -Djava.awt.headless=true Test3
An empty array returned unexpectedly
###@###.### 2005-04-26 09:47:58 GMT
========================== Test3.java ================================
import java.awt.*;
import java.awt.event.*;
public class Test3 {
public static void main( String argv[] ) {
Test3 t = new Test3();
t.go();
}
public void go() {
Toolkit t = Toolkit.getDefaultToolkit();
AWTEventListener ael = new MyAWTEventListener();
t.addAWTEventListener(ael, AWTEvent.CONTAINER_EVENT_MASK);
AWTEventListener[] outList =
t.getAWTEventListeners();
if (outList.length == 0) {
System.out.println("An empty array returned unexpectedly");
}
System.exit(0);
}
class MyAWTEventListener implements AWTEventListener {
public void eventDispatched(AWTEvent event) {}
}
}
================== output ================================
--> java -version
java version "1.6.0-ea"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-ea-b31)
Java HotSpot(TM) Client VM (build 1.6.0-ea-b31, mixed mode)
--> java -Djava.awt.headless=true Test3
An empty array returned unexpectedly
###@###.### 2005-04-26 09:47:58 GMT