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

46
LINES

< > BotCompany Repo | #1022899 // AI Album [Dyn Module, gallery of images for AI]

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

Uses 911K of libraries. Click here for Pure Java version (11538L/63K).

!7

cmodule AIAlbum > DynSCP {
  transient File dir;

  transient DynamicHStack buttons;
  transient ButtonImageLoader imageLoader;
  
  start {
    dir = aiImageAlbumDir();
    ownResource(vmBus_onDirChange(dir, r updateButtons));
  }

  JComponent visualize2() {
    setDir(dir);
    ret getComponent();
  }
  
  void setDir(File dir) {
    temp enter();
    setField(+dir);

    buttons = makeNiceButtons();
    imageLoader = new ButtonImageLoader(buttons) {
      void setAButtonsImage(JButton b, File f) {
        BufferedImage img = loadBufferedImage(f);
        BufferedImage preview = scaleBufferedImageToHeight(imageHeight, img);
        setButtonImage(b, preview);
      }
    };
    updateButtons();
    setComponent(jHigherScrollPane(jfullcenter(buttons)));
  }
  
  void updateButtons {
    if (dir == null || buttons == null) ret;
    temp enter();
    L<File> imageFiles = latestFilesFirst(listImageFiles(dir));
    L<TextImageAction> l = filesForNiceButtons(latestFilesFirst(imageFiles), f showImage);
    for (final TextImageAction tia : l)
      tia.popupMenuMaker = imageFilesPopupMenuFunction(tia);
    replaceNiceButtons(buttons, l);
    setModuleName("AI Album (" + l(l) + ")");
    if (imageLoader != null) imageLoader.update();
  }
}

Author comment

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: 304 / 5340
Version history: 5 change(s)
Referenced in: