I am working on a project and until now for my frame I had setundecorated(true)
to hide the above title bar and created a button to close the application because I wanted to call some methods before the application is closed.
But that doesn't help me when it is closed from the taskbar or some other way other than the button.
My question is how can I call some functions before my application is closed anyhow (from taskbar, taskmanager, from the close button in title bar or any possible way).