Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Exiting in java

This topic is 5439 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

YOu''d think this would be simple to find, but I can''t seem to find a function to use to exit the program when using java with swing. anyone want to shine some light?

Share this post

Link to post
Share on other sites
If you are using java with Swing then Probably you hacve a window of some kind, if you have a class tht inherits from JFrame or have a JFrame somewhere in a class you can do:

// Aggregation
JFrame j = new JFrame();

public class MyFrame extends JFrame {
public MyFrame() {
and then the window and application will die if you press the litle x in the top right corner of the window.

Otherwise if you got an window or not Zipsters advise allways works System.extit(0);


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!