Hey everyone,
This is a simple question, or at least, it should be :). I need a Timer to start when a JDialog opens and stop when it closes so a cute icon animation shows.
So far, I managed to detect when the window opens, but not when it closes. This code is at the JDialog constructor:
addWindowListener(new WindowAdapter()
{
@Override
public void windowClosed(WindowEvent we)
{
System.out.println("\t\t\t\twindowClosed");
busyIconTimer.stop();
}
@Override
public void windowOpened(WindowEvent we)
{
System.out.println("\t\t\t\twindowOpened");
busyIconTimer.start();
}
});
When I call "setVisible(true)", the windowClosed event is raised.
When I call "setVisible(false", no event is called whatsoever (tried all the events available).
Instead, if I call "mydialog.dispose()", the windowClosed event is called correctly.
But after this, if I call "setVisible(true)" again, the windowOpened isn't called.
Can anyone help me? :)
Thanks in advance.