I create a JWindow in my applet to display an update process, and I set the owner to the applet parent. My problem is that the JWindow is visible in all the tabs in my browser and not just the one containing my applet. Is it possible to add a Listener to know when my applet is visible? (And then hide the JWindow when it's not)
Applets appear to be added to a system Frame when they are displayed so you can use a WindowListener. I added the following code in the init() method of the JApplet:
Window window = SwingUtilities.windowForComponent(this);
window.addWindowListener( new WindowAdapter()
{
@Override
public void windowActivated(WindowEvent e)
{
displayWindow.setVisible( true );
}
@Override
public void windowDeactivated(WindowEvent e)
{
displayWindow.setVisible( false );
}
});