Uses 911K of libraries. Click here for Pure Java version (11538L/63K).
1 | !7 |
2 | |
3 | cmodule AIAlbum > DynSCP { |
4 | transient File dir; |
5 | |
6 | transient DynamicHStack buttons; |
7 | transient ButtonImageLoader imageLoader; |
8 | |
9 | start { |
10 | dir = aiImageAlbumDir(); |
11 | ownResource(vmBus_onDirChange(dir, r updateButtons)); |
12 | } |
13 | |
14 | JComponent visualize2() { |
15 | setDir(dir); |
16 | ret getComponent(); |
17 | } |
18 | |
19 | void setDir(File dir) { |
20 | temp enter(); |
21 | setField(+dir); |
22 | |
23 | buttons = makeNiceButtons(); |
24 | imageLoader = new ButtonImageLoader(buttons) { |
25 | void setAButtonsImage(JButton b, File f) { |
26 | BufferedImage img = loadBufferedImage(f); |
27 | BufferedImage preview = scaleBufferedImageToHeight(imageHeight, img); |
28 | setButtonImage(b, preview); |
29 | } |
30 | }; |
31 | updateButtons(); |
32 | setComponent(jHigherScrollPane(jfullcenter(buttons))); |
33 | } |
34 | |
35 | void updateButtons { |
36 | if (dir == null || buttons == null) ret; |
37 | temp enter(); |
38 | L<File> imageFiles = latestFilesFirst(listImageFiles(dir)); |
39 | L<TextImageAction> l = filesForNiceButtons(latestFilesFirst(imageFiles), f showImage); |
40 | for (final TextImageAction tia : l) |
41 | tia.popupMenuMaker = imageFilesPopupMenuFunction(tia); |
42 | replaceNiceButtons(buttons, l); |
43 | setModuleName("AI Album (" + l(l) + ")"); |
44 | if (imageLoader != null) imageLoader.update(); |
45 | } |
46 | } |
Began life as a copy of #1019188
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1022899 |
Snippet name: | AI Album [Dyn Module, gallery of images for AI] |
Eternal ID of this version: | #1022899/6 |
Text MD5: | 53f9d1c57252e5f27dea49c2fc2dbea5 |
Transpilation MD5: | aa7ae0378ef719059e497436f384fcec |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-04-14 19:35:45 |
Source code size: | 1302 bytes / 46 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 305 / 5342 |
Version history: | 5 change(s) |
Referenced in: | [show references] |