asclass DMPopOutHandler { transient DynModule module; transient JButton popDownButton; abstract void addControl(JComponent c); void start { module = dm_current_mandatory(); dm_vmBus_onMessages_q(ll("modulePoppedOut", "modulePoppedIn"), (m, myFrame) -> { if (dm_isMe(m)) adjustUIForPoppedOutWindow(); }); } void adjustUIForPoppedOutWindow swing { if (popDownButton == null) { Window window = cast getWindow(dm_vis()); var popBackInButton = findButton(window, "Pop Back In"); var parent = getParent(popBackInButton); print(+parent); removeFromParent(parent); // hide controls popDownButton = jPopDownButton_noText( "Pop Back In", r { dm_popInModule(module) }, jCheckBoxMenuItem("Always On Top", isAlwaysOnTop(window), r { temp module.enter(); dm_toggleAlwaysOnTop(); }), ); addControl(popDownButton); } } }