This site requires JavaScript, please enable it in your browser!
Greenfoot
Username
Password
Remember Me?
Sign Up, Lost Password
Activity
About
Documentation
Download
Discuss
Scenarios
Kartoffelbrot
wrote ...
2013/8/1
Closing JFrames
Kartoffelbrot
2013/8/1
#
Hello, I need help in closing JFrames. I tried to use System.exit(0); , but then the whole program closes. Any ideas?
Gevater_Tod4711
2013/8/1
#
If you want to close only one frame try using the
dispose()
method.
Kartoffelbrot
2013/8/1
#
Hat funktioniert, danke!
Ashima
2013/8/1
#
you should use the setDefaultCloseOperation(EXIT_ON_CLOSE) method.
Gevater_Tod4711
2013/8/1
#
But this method will only close the frame when you click the close button in the top right side of the window.
Ashima
2013/8/1
#
yes @Geavater_Tod4711, so how and when do you want to close the JFrame?
Gevater_Tod4711
2013/8/1
#
If you want to close the Frame with a method call (e.g. when your algorithm you use in a frame terminates) you can't use the setDefaultCloseOperation method but have to use the dispose method.
Ashima
2013/8/1
#
Okay :P Thanks again for knowledge :)
You need to login to post a reply.
X