Jump to content
  • Advertisement
Sign in to follow this  
Pac300

[java] A quick Java Question

This topic is 4250 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

How can i make my java application stop functioning when i hit close; Right now what is happening is an midi but when I close the program the music is still playing till i go into my process list and stop javaw.exe how can i stop this?

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Is this a swing application?

Try adding something like this when you initialize it.

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

Share this post


Link to post
Share on other sites
if it's not a Swing app (i.e., an AWT app), then you need to add a WindowListener to the frame that you want to close. The WindowListener interface includes a method, windowClosing(WindowEvent), that you can capture to close your app with a call to System.exit();. Don't forget to dispose any resources before you kill the app.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!