Sign in to follow this  

[java] A quick Java Question

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

This topic is 4030 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this