stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
public void handle(WindowEvent we) {
Platform.setImplicitExit(false);
stage.close();
}
});
It is equivalent to hide
. So when you are going to open it next time, you just check if the stage
object is exited or not. If it is exited, you just show()
i.e. (stage.show())
call. Otherwise, you have to start the stage.