static A pMainAsComponent(Class c) { final A applet = pMain(c); Window w = getWindow(applet); applet.frame = null; for (WindowListener l : w.getWindowListeners()) w.removeWindowListener(l); getParent(applet).remove(applet); disposeWindow(w); ret applet; }