Is there an event that gets fired when somebody closes a desktop-based Java/JavaFx application from the task bar (and not directly from the application itself) by right clicking on the application and executing Close Window?
Currently, if I close the window from the taskbar, the application window gets closed but the process does not get killed and keeps running in the background. I want to shut down the application completely, so that the Embedded Derby DB within the application gets disconnected.
I have tried the Stage’s setOnHiding(), setOnCloseRequest() and other similar methods, but to no avail.
Thanks for all your help !
You can try to use ShutdownHook to free application resources.