1 | sclass dm_ReloadButton extends JLabel { |
2 | O moduleID; |
3 | |
4 | *(fO *moduleID) { |
5 | initImageLabel(this, #1101440); |
6 | setToolTip(this, "Module can be reloaded"); |
7 | onClick(this, r { |
8 | removeFromParent(dm_ReloadButton.this); |
9 | dm_reloadModuleInBackground(moduleID); |
10 | }); |
11 | } |
12 | } |
13 | |
14 | // tested with JTattoo and Windows L&F |
15 | sbool dm_addReloadButtonToModuleTitlePane(fO moduleID) { |
16 | ret swing(func -> bool { |
17 | final JComponent c = internalFrameTitleComponent((JInternalFrame) dm_frame(moduleID)); |
18 | if (c == null) false; |
19 | if (containsChildWithShortName(c, 'dm_ReloadButton)) false; |
20 | |
21 | final dm_ReloadButton btn = swingNu(dm_ReloadButton, moduleID); |
22 | addBottomMargin(btn, 2); |
23 | final int nChildren = countChildren(c); |
24 | final int w = preferredWidth(btn), h = preferredHeight(btn), gap = 5; |
25 | addComponent(c, btn); |
26 | final Runnable relayout = r { |
27 | setBounds(btn, |
28 | max(30, minXOfFirstNChildren_rightOf(c, nChildren, 20)-w-gap), |
29 | (c.getHeight()-h)/2, w, h) |
30 | }; |
31 | final ComponentListener resizeListener = resizeListener(relayout); |
32 | bindToComponent(btn, |
33 | r { c.addComponentListener(resizeListener); callF(relayout) }, |
34 | r { c.removeComponentListener(resizeListener) }); |
35 | vmBus_send('addedReloadButtonToModule, moduleID); |
36 | true; |
37 | }); |
38 | } |
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: | #1020061 |
Snippet name: | dm_addReloadButtonToModuleTitlePane |
Eternal ID of this version: | #1020061/17 |
Text MD5: | b972494e18e25fc1f2702ab32c78986d |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-12-07 01:35:54 |
Source code size: | 1336 bytes / 38 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 321 / 387 |
Version history: | 16 change(s) |
Referenced in: | [show references] |