I'm working on a project, and i put in some code to tell the program when to stop. Basically it completes it's task then shuts itself down, however it outputs information to a text box aka log. I'd like to stop the program from running, yet leave the log open untill it is X'ed out. As it is now i'm using some control to tell an if statement the process in complete, then doing a System.exit(0); Is there a System.exit(?) that would leave the UI's open?


Recommended Answers

All 3 Replies

You will have to control when the program uses the System.exit() method. Don't use it until you want the the program execution to end.
You could add listeners to the window you want to leave displayed that would call System.exit() when the window is closed.

What NormR1 said is the perfect solution to what you said. you could also write the information to a text file for the user to view? Even both :) heres some exampke on adding listners to frames: http://docs.oracle.com/javase/tutorial/uiswing/events/windowlistener.html and http://www.java-tips.org/java-se-tips/java.awt.event/how-to-add-window-listener-to-the-window-in.html

Thanks guys, thanks for the links also.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.