This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
I have one JFrame running in my program, and some non-gui threads. I want to perform a shutdown routine on the threads when the JFrame is closed. To do this, I have set JFrame.DISPOSE_ON_CLOSE. In another thread, I call join() on the AWT thread, so that when the AWT thread finishes (JFrame dispose()) I can excute the shutdown routines:
It seems to work. Is this a right way of doing things?
Mikpo Siru wrote:I want to perform a shutdown routine on the threads when the JFrame is closed.
Use a WindowListener and its windowClosed method. Don't be confused with windowClosing - that's called when you press the X button to close the frame. windowClosed will be called when the window is actually closed.