Libraryless. Click here for Pure Java version (10281L/71K).
1 | static JLabel mapMethodLike dm_boolFieldImageSwitch(S field, S offImageID, S onImageID, O... _) { |
2 | optPar S offToolTip; |
3 | optPar S onToolTip; |
4 | SimpleLiveValue<Bool> lv = dm_fieldLiveValue(field); |
5 | JLabel l = jimage(isTrue(lv!) ? onImageID : offImageID); |
6 | onLeftClick(l, r { lv.set(!isTrue(lv!)); }); |
7 | bindLiveValueListenerToComponent(l, lv, r { |
8 | bool b = isTrue(lv!); |
9 | setImage(b ? onImageID : offImageID, l); |
10 | S toolTip = b ? onToolTip : offToolTip; |
11 | if (toolTip != null) setToolTip(l, toolTip); |
12 | }); |
13 | ret l; |
14 | } |
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1027539 |
Snippet name: | dm_boolFieldImageSwitch |
Eternal ID of this version: | #1027539/3 |
Text MD5: | 93b80da4cf348a0a50b9e80770cae72f |
Transpilation MD5: | 99b97407c844d87299d0c73dadd5d2e4 |
Author: | stefan |
Category: | javax / stefan's os |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-03-23 13:44:08 |
Source code size: | 543 bytes / 14 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 204 / 302 |
Version history: | 2 change(s) |
Referenced in: | [show references] |