desktop.invite(new ComponentVisitor() { public void visit(SComponent c) { if (! (c instanceof SInternalFrame)) return; SInternalFrame ff = (SInternalFrame) c; if (ff != frame && ff.isMaximized()) { ff.setMaximized(false);  frame.setMaximized(true);
try { desktop.invite(new ComponentVisitor() { public void visit(SComponent c) { if (! (c instanceof SInternalFrame)) return; SInternalFrame ff = (SInternalFrame) c; if (ff != frame && ff.isMaximized()) { ff.setMaximized(false);  frame.setMaximized(true); }
    public void addNewFrame(final SInternalFrame frame) {        desktop.add(frame);        desktop.invite(new ComponentVisitor() {                public void visit(SComponent c) {                    if (! (c instanceof SInternalFrame))                        return;                    SInternalFrame ff = (SInternalFrame) c;                    if (ff != frame && ff.isMaximized()) {                        ff.setMaximized(false);                        // set _our_ frame maximized, then.                        frame.setMaximized(true);                    }                }            });    }