I am writing an app that requires the user to enter some data into a Swing GUI which the app will then use. After the user enters the data, there is no longer any need for the GUI as the app will then write some data to files.
The General idea is this:
launchGui();
closeGui();
continueWithComputation();
I understand that Swing uses a few threads in the background which I understand is why the program doesn’t block until the GUI is closed.
Is it possible in any way to wait for the GUI to close (single JFrame closed with dispose()) before continuing with continueWithComputation()?
user actions add WindowListener
from code to call
JFrame#setVisible(false), then you can runningcontinueWithComputation(), you have to close this JVM bySystem.exit(0), otherwise stays in PC’s RAM untill restarted or power-off