In JavaFX, how to hide a scene without saving it and not closing the application?

I need to create an application that shows the main stage for the user, and if the user closes the scene, instead of ending the application, he just needs to hide the scene for later use. When swinging, we could just call setVisible (false) for a JFrame or JDialog, but how to do it in JavaFX?

+5
source share
1 answer

After starting the JavaFX toolkit by default, it closes when the last visible window closes.

To prevent this, you can call

Platform.setImplicitExit(false); 

You usually do this in your start(...) method, although it can be called from any thread.

To exit the application, you will need to call

 Platform.exit(); 

(since the application no longer automatically exits).

+18
source

All Articles