Two + 1 Questions:
I've an stand alone application and created a runnable jar for it. Now, when I double-click it, a
JFrame
window opens and I need to log in. The problem is that I can open multiple JFrame windows if I double-click on it. What I need is once I have logged in, anytime I try to open it again, it should show me the currently logged in window. Or to put it this way, create a single instance of thatJFrame
window.When closing the window, I need to do some operations before closing. I know that I can use a
WindowListener
but this does not work when I shutdown the JFrame (as in terminate the application). Is there a way to do any action before terminating manually?
EDIT : Another question:
- I did a
setExtendedState(JFrame.ICONIFIED);
for minimizing theJFrame
window when 'x'(close) is clicked. It minimizes but vanishes from the task bar. Is there a way to keep in the task bar like how the normal minimize works?