Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

51
LINES

< > BotCompany Repo | #1019109 // Images In Directory v2 [Dyn Module, OK]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 1113K of libraries. Compilation Failed (15961L/86K).

1  
!7
2  
3  
cm ImagesInDirectory extends DynSCP {
4  
  File dir;
5  
6  
  transient DynamicHStack buttons;
7  
  transient ButtonImageLoader imageLoader;
8  
  
9  
  start {
10  
    ownResource(vmBus_onDirChange(dir, r updateButtons));
11  
  }
12  
13  
  JComponent visualize2() {
14  
    print("dir: " + dir);
15  
    if (dir == null)
16  
      ret jHandleFileDrop(jcenteredbutton("Select directory...", rThread select), voidfunc(File f) { setDir(f) });
17  
    else {
18  
      setDir(dir);
19  
      ret getComponent();
20  
    }
21  
  }
22  
  
23  
  void select {
24  
    temp enter();
25  
    selectDir(voidfunc(File dir) { setDir(dir) });
26  
  }
27  
  
28  
  void setDir(File dir) {
29  
    temp enter();
30  
    setField(+dir);
31  
32  
    buttons = makeNiceButtons();
33  
    imageLoader = new ButtonImageLoader(buttons);
34  
    updateButtons();
35  
    setComponent(jHigherScrollPane(jfullcenter(buttons)));
36  
  }
37  
  
38  
  void updateButtons {
39  
    if (dir == null || buttons == null) ret;
40  
    temp enter();
41  
    L<File> imageFiles = listImageFiles(dir);
42  
    L<TextImageAction> l = filesForNiceButtons(sortFilesByDate(
43  
      imageFiles), lambda1 showImage);
44  
    for (final TextImageAction tia : l)
45  
      tia.popupMenuMaker = imageFilesPopupMenuFunction(tia);
46  
    replaceNiceButtons(buttons, l);
47  
    setModuleName(
48  
      n2(l, "image") + " in directory " + fileName(dir));
49  
    if (imageLoader != null) imageLoader.update();
50  
  }
51  
}

Author comment

Began life as a copy of #1015922

download  show line numbers  debug dex  old transpilations   

Travelled to 12 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1019109
Snippet name: Images In Directory v2 [Dyn Module, OK]
Eternal ID of this version: #1019109/20
Text MD5: c3b97e3cd1425f4d635bf01bf6aab3e1
Transpilation MD5: 6f2c35299de61716d7c6aa00bc103775
Author: stefan
Category: javax / gui
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-10 17:40:09
Source code size: 1350 bytes / 51 lines
Pitched / IR pitched: No / No
Views / Downloads: 356 / 992
Version history: 19 change(s)
Referenced in: [show references]