-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
1.4.2
-
x86
-
windows_98
FULL PRODUCT VERSION :
java version "1.4.2_03"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_03-b02)
Java HotSpot(TM) Client VM (build 1.4.2_03-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
Invoking dispose() on a java.awt.Frame object does not fire a vetoable windowClosing() event to the Frame's listeners.
I am writing a test case, and trying to simulate the GUI behavior of closing a window, without having to actually go through the GUI. I would expect dispose() to warn listeners that their target window was closing, in the same way that closing the window through the GUI does.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the attached test program. This test program creates a window, adds a windowListener, then invokes "dispose".
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
WindowClosing and WindowClosed should each be invoked.
ACTUAL -
WindowClosed is invoked, but WindowClosing is not.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.Frame;
import java.awt.Window;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class WindowClosingTest extends WindowAdapter {
private Window window = new Frame();
public WindowClosingTest() {
window.addWindowListener(this);
window.dispose();
}
public static void main(String[] args) {
new WindowClosingTest();
}
public void windowClosing(WindowEvent e) {
System.out.println("WindowClosing called.");
}
public void windowClosed(WindowEvent e) {
System.out.println("WindowClosed called.");
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
To simulate what the GUI does when windows are closed, instead of invoking "dispose()", you could manually post the WINDOW_CLOSING and WINDOW_CLOSED events to the Event Queue.
###@###.### 2005-1-04 05:43:27 GMT
java version "1.4.2_03"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_03-b02)
Java HotSpot(TM) Client VM (build 1.4.2_03-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
Invoking dispose() on a java.awt.Frame object does not fire a vetoable windowClosing() event to the Frame's listeners.
I am writing a test case, and trying to simulate the GUI behavior of closing a window, without having to actually go through the GUI. I would expect dispose() to warn listeners that their target window was closing, in the same way that closing the window through the GUI does.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the attached test program. This test program creates a window, adds a windowListener, then invokes "dispose".
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
WindowClosing and WindowClosed should each be invoked.
ACTUAL -
WindowClosed is invoked, but WindowClosing is not.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.Frame;
import java.awt.Window;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class WindowClosingTest extends WindowAdapter {
private Window window = new Frame();
public WindowClosingTest() {
window.addWindowListener(this);
window.dispose();
}
public static void main(String[] args) {
new WindowClosingTest();
}
public void windowClosing(WindowEvent e) {
System.out.println("WindowClosing called.");
}
public void windowClosed(WindowEvent e) {
System.out.println("WindowClosed called.");
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
To simulate what the GUI does when windows are closed, instead of invoking "dispose()", you could manually post the WINDOW_CLOSING and WINDOW_CLOSED events to the Event Queue.
###@###.### 2005-1-04 05:43:27 GMT