Libraryless. Click here for Pure Java version (14758L/102K).
1 | !7 |
2 | |
3 | import javax.swing.plaf.InternalFrameUI; |
4 | import javax.swing.plaf.basic.BasicInternalFrameUI; |
5 | |
6 | module SeparateDesktopPaneSpike > DynSingleFunctionWithPrintLog { |
7 | void doIt { |
8 | final JInternalFrame myFrame = cast dm_frame(); |
9 | if (myFrame == null) ret; |
10 | if (getParent(myFrame) != dm_desktopPane()) ret with moveBack(); |
11 | Rectangle boundsOnScreen = boundsOnScreen(myFrame); |
12 | final JDesktopPane desktopPane = jDesktopPane(); |
13 | autoFixDesktopPane(desktopPane); |
14 | showFrame(dm_moduleName(), desktopPane); |
15 | setFrameBounds(desktopPane, boundsOnScreen); |
16 | swing { |
17 | removeFromParent(myFrame); |
18 | onResizeAndNow(desktopPane, r { |
19 | myFrame.setBounds(0, 0, desktopPane.getWidth(), desktopPane.getHeight()) |
20 | }); |
21 | desktopPane.add(myFrame); |
22 | myFrame.setMaximum(true); |
23 | myFrame.setMaximizable(false); |
24 | myFrame.setClosable(false); |
25 | myFrame.setIconifiable(false); |
26 | InternalFrameUI ui = myFrame.getUI(); |
27 | if (ui cast BasicInternalFrameUI) { |
28 | ui.setNorthPane(null); |
29 | } |
30 | } |
31 | } |
32 | |
33 | void moveBack ctex { |
34 | final JInternalFrame myFrame = cast dm_frame(); |
35 | if (myFrame == null) ret; |
36 | JDesktopPane desktopPane = cast getParent(myFrame); |
37 | if (desktopPane == dm_desktopPane()) ret; |
38 | removeFromParent(myFrame); |
39 | myFrame.updateUI(); |
40 | myFrame.setMaximum(false); |
41 | myFrame.setMaximizable(true); |
42 | myFrame.setClosable(true); |
43 | myFrame.setIconifiable(true); |
44 | dm_desktopPane().add(myFrame); |
45 | Rectangle bounds = rectangleFromScreenToComponent(boundsOnScreen(getFrame(desktopPane)), dm_desktopPane()); |
46 | print("Setting bounds: " + bounds); |
47 | myFrame.setBounds(bounds); |
48 | fixInternalFrame(myFrame); |
49 | myFrame.toFront(); |
50 | myFrame.setSelected(true); |
51 | print("Have bounds: " + getBounds(myFrame); |
52 | disposeFrame(desktopPane); |
53 | desktopPane = null; |
54 | call(dm_getStem(this), 'enhanceFrame, myFrame); // re-add title menus |
55 | } |
56 | } |
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1020192 |
Snippet name: | Move Module Window To Separate Desktop Pane (And Back) Spike [WORKS] |
Eternal ID of this version: | #1020192/42 |
Text MD5: | 214876ec920ec0613f6a5e297aaca247 |
Transpilation MD5: | df94e971df11b5d75e7080d339bc3bff |
Author: | stefan |
Category: | javax / stefan's os |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-12-10 01:57:17 |
Source code size: | 1985 bytes / 56 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 369 / 712 |
Version history: | 41 change(s) |
Referenced in: | [show references] |