// TODO: sometimes they can't be closed anymore? (see #1014939)
sclass FrameCoActivator {
long lastTime;
int timeout = 100; // prohibit endless loop
*(final Frame... frames) {
for (final Frame f1 : frames) {
f1.addWindowListener(new WindowAdapter {
public void windowIconified(WindowEvent e) {
lastTime = sysNow();
}
public void windowActivated(WindowEvent e) {
if (sysNow() >= lastTime+timeout) {
lastTime = sysNow();
//print(text);
for (Frame f2 : frames)
if (f2 != f1)
activateFrame(f2);
activateFrame(f1);
}
}
});
}
}
}
static Frame[] coActivateFrames(Frame... frames) {
new FrameCoActivator(frames);
ret frames;
}
static L coActivateFrames(L frames) {
coActivateFrames(toArray(frames, Frame.class));
ret frames;
}