@Override
public void eventDispatched(AWTEvent e) {
if (!(e instanceof ComponentEvent)) {
return;
}
ComponentEvent event = (ComponentEvent) e;
Component component = event.getComponent();
// This is our sole means of accessing other AppContexts (if running within an applet). We look for window events
// beyond OPENED in order to catch windows that have already opened by the time we start listening but which are not
// in the Frame.getFrames list (i.e. they are on a different context). Specifically watch for COMPONENT_SHOWN on
// applets, since we may not get frame events for them.
if (!(component instanceof Applet) && !(component instanceof Window)) {