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); bool alwaysOnTop ifndef PreV7 = m.hasFlag(m.ALWAYSONTOPWHENPOPPEDOUT) endifndef; // make a new frame with a new DesktopPane JDesktopPane desktopPane = jDesktopPane(); autoFixDesktopPane(desktopPane); showFrame(m.moduleName(), desktopPane); JFrame frame = getFrame(desktopPane); // title popup menu items if (!frameTitlePopupMenuItems(frame, "Pop Back In", r { stefansOS_popInModule(m) }, jCheckBoxMenuItem("Always On Top", alwaysOnTop, r { toggleAlwaysOnTop(frame) }))) // can't add title menu - add button instead replaceComponent(desktopPane, func(JComponent dp) -> Component { withRightAlignedButtons(dp, onChange(jCheckBox("Always On Top", alwaysOnTop), r { toggleAlwaysOnTop(frame) }), "Pop Back In", r { stefansOS_popInModule(m) }) }); // position, listeners, flags, show 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); frame.setAlwaysOnTop(alwaysOnTop); InternalFrameUI ui = myFrame.getUI(); if (ui cast BasicInternalFrameUI) { ui.setNorthPane(null); } } }