i want to execute a particular set of commands when the program exits by pressing the cross on the right hand top corner
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Depending of what you really want to do, there are few ways to do it:
1) If you want to do it on UI level use WindowListener [link]
2) If you want to do it on JVM level, use ShutdownHooks [link]