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

29
LINES

< > BotCompany Repo | #1009387 // Show a random image from image server v2

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Uses 3874K of libraries. Click here for Pure Java version (9031L/61K).

!7

static S id;
static ImageSurface is;
static JButton btnNext;
static JLabel lblText;

p-noconsole { autoRestart(); next(); }

svoid next {
  disableButton(btnNext);
  id = randomImageServerID();
  thread {
    try {
      BufferedImage img = loadImage2_progressBar(id);
      bool first = is == null;
      S name = getSnippetTitle(id);
      is = showImage_centered(is, name + " - " + id, img);
      if (first) {
        addToWindowWithMargin(is, lblText = jcenteredboldlabel(name));
        addToWindow(is, withTopMargin(jcenteredline(focusLater(btnNext = jbutton("Next image", f next)))));
      }
      setText(lblText, name);
      centerPackedFrame(is);
    } finally {
      enableButton(btnNext);
    }
  }
}

Author comment

Began life as a copy of #1003774

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: #1009387
Snippet name: Show a random image from image server v2
Eternal ID of this version: #1009387/19
Text MD5: bec9b01c86397b2a6de3e8fbe803b918
Transpilation MD5: ed7605a78ee7c99a3cfaad02ea6e725d
Author: stefan
Category: javax / gui
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-05-06 15:44:20
Source code size: 748 bytes / 29 lines
Pitched / IR pitched: No / No
Views / Downloads: 619 / 2304
Version history: 18 change(s)
Referenced in: [show references]