Libraryless. Click here for Pure Java version (14450L/100K).
!7 sclass ImagePreview extends DynSCP { new DynModuleRef mate; transient Image shownImage; JComponent visualize2() { Image image = shownImage; if (image == null) ret jcenteredlabel("Need image"); ret jimage(image); } Image imageFromMate() { ret castCall(mate!, 'getImage); } void update { lock lock; // notice mate gone away if (mate! != null && !dm_moduleStillThere(mate!)) { mate.set(null); setField(shownImage := null); revisualize2(); } // find new mate if (mate! == null) if (setField(mate := DynModuleRef(dm_findMateOfType(this, 'ImageInfo)))) revisualize2(); if (setField(shownImage := imageFromMate())) revisualize2(); } }
Began life as a copy of #1015922
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1016035 |
Snippet name: | Image Preview |
Eternal ID of this version: | #1016035/11 |
Text MD5: | 2caff3719884db188d8a9db5f96217b8 |
Transpilation MD5: | be0cebb583351ea4268e94dc93e73e24 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-06-08 18:38:08 |
Source code size: | 793 bytes / 36 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 422 / 565 |
Version history: | 10 change(s) |
Referenced in: | -