Please use the code button; since you are new I have edited your post and you can see how it improves the look of your code and makes the indentation errors easier to find
You need to go through the JFrame documentation and look what happens when you close a frame. Also find out about threads in Swing; the "main" thread is still running at this point. That is probably your problem.
I shall move this discussion to the Swing (not "swings") forum.
Joined: Oct 24, 2010
Thanks for your post...as well as editing my post using code.
That works fine if your application only has one JFrame. If it can have multiple then JFrame.DISPOSE_ON_CLOSE is a better option. Once the last JFrame has been disposed the Event Dispatcher Thread will end and so will your program (provided there are no other non-daemon threads running).
Rob Prime wrote:That works fine if your application only has one JFrame. . . .
. . . and you have no other actions you wish to perform while the frame closes, eg saving something to a file. When the JVM exits, the file might only be partially written, and may be corrupted. In that case a WindowListener can be used to do the file writing on closing.
Rob Prime wrote:TOnce the last JFrame has been disposed the Event Dispatcher Thread will end and so will your program (provided there are no other non-daemon threads running).
One situation I'm aware of that causes the EDT to not terminate is when a Swing Timer is still running. And one way to guard against that in a situation that makes it difficult to code for stopping the Timer is to include a check in its actionPerformed:
There are no new questions, but there may be new answers.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Not able to resume command promt after using swings