A JavaFX Tutorial on how to register for the closing event and how to make sure all threads are closed upon exit.
There are several things you need to be aware of when exiting an application.
1) make sure you have a way to dispose of all existing threads cleanly. Often by providing a boolean flag that will terminate the thread.
2) register for the setoncloserequest event and make sure that you call
Platform.exit();//gui thread
System.exit(0);//normal exit killing the JVM
The full blog version of this GUI tutorial is on our website: https://wp.me/pagKw9-1qy
The source code for this JavaFX example application is on our github repo: https://github.com/noblecodemonkeys/F...