static A maximizeFrame(A c) { JFrame f = swing(func -> JFrame { JFrame f = getFrame(c); if (f != null) f.setExtendedState(JFrame.MAXIMIZED_BOTH); ret f; }); // wait until frame is actually maximized so // we can add components based on correct size if (f != null && !isAWTThread()) { Dimension d = maximumWindowBounds().getSize(); long start = sysNow(); repeat with ms sleep 1 { if (f.getWidth() >= d.getWidth()-100 && f.getHeight() >= d.getHeight()-100) break; if (sysNow() >= start+100) { warn("maximizeFrame timeout"); break; } } } ret c; }