static new ThreadLocal addInternalFrame_dontSelect; static new ThreadLocal addInternalFrame_layer; static JInternalFrame addInternalFrame(final JDesktopPane desktop, fS title, final int x, final int y, final int w, final int h) { ret addInternalFrame(desktop, title, x, y, w, h, null); } static JInternalFrame addInternalFrame(final JDesktopPane desktop, fS title, final int x, final int y, final int w, final int h, final Component contents) { ret addInternalFrame(desktop, title, rect(x, y, w, h), contents); } static JInternalFrame addInternalFrame(final JDesktopPane desktop, fS title, final Component contents) { ret addInternalFrame(desktop, title, null, contents); } static JInternalFrame addInternalFrame(final JDesktopPane desktop, fS title, final Rect r, final Component contents) { final bool dontSelect = isTrue(optParam(addInternalFrame_dontSelect)); final Int layer = optParam(addInternalFrame_layer); ret swing(func -> JInternalFrame { JInternalFrame frame; if (contents instanceof JInternalFrame) frame = (JInternalFrame) contents; else { frame = jInternalFrame(title); setInternalFrameContents(frame, contents); } frame.setVisible(true); desktop.add(frame, layer); if (r != null) setBounds(frame, r); else internalFrameDefaultPosition(frame); if (dontSelect) frame.toFront(); else frame.setSelected(true); ret fixInternalFrame(frame); }); } static JInternalFrame addInternalFrame(JDesktopPane desktop, S title) { ret addInternalFrame(desktop, title, jpanel()); }