J
Jack Dowson
Hello Everybody:
As we all know,System.exit(0) is often used to quit the program.
But when it applied to some of my programs,the outcome was not so.
I created a frame using class JFrame.Then I registerd WindowsAdapter on
the close action,and here came the problem:
When I only used System.exit(0) in the rewrote of method
windowClosing,it cloud never close the window normally.(I could only use
ctrl+c or more often directly kill the process to end this)
But when I added frame.dispose() before it,then it worked well,
here frame is an instance created by JFrame.If the sentence
frame.dispose() came after System.exit(0),neither would it do the job.
Why?
My os is WindowsXP,and jdk version is(created by command java -version):
java version "1.5.0_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode, sharing)
Any help will be greatly appreciated!
Dowson.
As we all know,System.exit(0) is often used to quit the program.
But when it applied to some of my programs,the outcome was not so.
I created a frame using class JFrame.Then I registerd WindowsAdapter on
the close action,and here came the problem:
When I only used System.exit(0) in the rewrote of method
windowClosing,it cloud never close the window normally.(I could only use
ctrl+c or more often directly kill the process to end this)
But when I added frame.dispose() before it,then it worked well,
here frame is an instance created by JFrame.If the sentence
frame.dispose() came after System.exit(0),neither would it do the job.
Why?
My os is WindowsXP,and jdk version is(created by command java -version):
java version "1.5.0_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode, sharing)
Any help will be greatly appreciated!
Dowson.