Query for JFrame.EXIT_ON_CLOSE

Is there any way I can query this event and have it do some clean-up before exit.

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

2 comments
Comment actions Permalink

Never mind. I had a different problem in my code that was making this necessary. I fixed my problem and this is no longer necessary.

However, if you know how to do it I would still be interested.

- Rex

P.S. Many of you have been very helpful and I really appreciate it.

0
Comment actions Permalink

Rex Winn wrote:

Is there any way I can query this event and have it do some clean-up before exit.

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);


If you want to clean up before exiting, you should set the close
operation to DO_NOTHING and add a WindowListener that does the
appropriate thing when windowClosing() is called.

0

Please sign in to leave a comment.