-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
1.0
-
sparc
-
solaris_2.4, solaris_2.5
The following simple program implements a simple Frame.
When the user uses the window GUI to quit the Frame, the
Frame goes away, but the Java interpreter is left hanging: it doesn't
exit.
I could call System.exit(0); from the event handler, but that then
precludes the use of this frame in contexts where it might coexist
with other frames ... It would be a bummer in that case if quitting a
frame blew away the domain!
import java.awt.*;
public class Main extends Frame
{
public static void main(String[] args) {
Main m = new Main();
m.pack();
m.show();
m.resize(new Dimension(100, 100));
}
Main() {
super("Test");
}
public boolean handleEvent(Event evt) {
if (evt.id == Event.WINDOW_DESTROY)
dispose();
return false;
}
}
The description field as copied from bug report 1232920 follows:
The Frame class does not handle the Event.WINDOW_DESTROY event by
default, which means that if the programmer does not explicitly subclass
the Frame and handle this event specifically, nothing will happen when the
user selects "Close" or "Quit" (in Solaris at least) off the window menu.
By default, the Frame should handle this event in a reasonable way.
When the user uses the window GUI to quit the Frame, the
Frame goes away, but the Java interpreter is left hanging: it doesn't
exit.
I could call System.exit(0); from the event handler, but that then
precludes the use of this frame in contexts where it might coexist
with other frames ... It would be a bummer in that case if quitting a
frame blew away the domain!
import java.awt.*;
public class Main extends Frame
{
public static void main(String[] args) {
Main m = new Main();
m.pack();
m.show();
m.resize(new Dimension(100, 100));
}
Main() {
super("Test");
}
public boolean handleEvent(Event evt) {
if (evt.id == Event.WINDOW_DESTROY)
dispose();
return false;
}
}
The description field as copied from bug report 1232920 follows:
The Frame class does not handle the Event.WINDOW_DESTROY event by
default, which means that if the programmer does not explicitly subclass
the Frame and handle this event specifically, nothing will happen when the
user selects "Close" or "Quit" (in Solaris at least) off the window menu.
By default, the Frame should handle this event in a reasonable way.
- duplicates
-
JDK-1232920 Frame doesn't handle WINDOW_DESTROY by default - leaves window up
- Closed