I am creating a desktop application that has a login and logout with a server.
I need to exit the application when someone closes the window, so I use these codes
primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() { @Override public void handle(WindowEvent event) { event.consume(); closeWindow(); } });
where closeWindow () contains the logout and other related steps.
Now there is a problem when the application unexpectedly closes or when someone forcibly terminates / closes it from the task manager (by completing the process).
Is there any event in JavaFX for forced closure or unexpected closure? Or if there is a way to stop him?
source share