Which sort of listener do I have to add to a JFrame to detect when it is being hidden/shown via setVisible
?
I tried using a WindowListener and the windowOpened
and windowClosed
methods, but they only work for the first time that a window is opened (windowOpened
) or, respectively, when the window is closed using the dispose method (windowClosed
). That is not enough for me. I want to be notified every time the window is made visible and invisible on the screen using setVisible
.
Is there a standard swing way to achieve this, or do I need to make my own (by, say, overriding the setVisible
method)?