• Advertisement
Sign in to follow this  

[java] A quick Java Question

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