import javax.swing.plaf.InternalFrameUI; import javax.swing.plaf.basic.BasicInternalFrameUI; svoid stefansOS_popOutModule(Module m) ctex { final JInternalFrame myFrame = cast getPossiblyInternalFrame(m.vis); if (myFrame == null) ret; if (getParent(myFrame) != main.desktop) ret; // popped out already Rectangle boundsOnScreen = boundsOnScreen(myFrame); final JDesktopPane desktopPane = jDesktopPane(); autoFixDesktopPane(desktopPane); showFrame(m.moduleName(), desktopPane); final JFrame frame = getFrame(desktopPane); if (!frameTitlePopupMenuItems(frame, "Pop Back In", r { stefansOS_popInModule(m) }, jCheckBoxMenuItem("Always On Top", false, r { toggleAlwaysOnTop(frame) }))) // can't add title menu - add button instead replaceComponent(desktopPane, func(JComponent dp) -> Component { withRightAlignedButtons(dp, onChange(jCheckBox("Always On Top"), r { toggleAlwaysOnTop(frame) }), "Pop Back In", r { stefansOS_popInModule(m) }) }); setFrameBounds(desktopPane, boundsOnScreen); swing { removeFromParent(myFrame); onResizeAndNow(desktopPane, r { myFrame.setBounds(0, 0, desktopPane.getWidth(), desktopPane.getHeight()) }); desktopPane.add(myFrame); myFrame.setMaximum(true); myFrame.setMaximizable(false); myFrame.setClosable(false); myFrame.setIconifiable(false); if (m.hasFlag(m.ALWAYSONTOPWHENPOPPEDOUT)) myFrame.setAlwaysOnTop(true); InternalFrameUI ui = myFrame.getUI(); if (ui cast BasicInternalFrameUI) { ui.setNorthPane(null); } } }