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).

1  
!7
2  
3  
static S id;
4  
static ImageSurface is;
5  
static JButton btnNext;
6  
static JLabel lblText;
7  
8  
p-noconsole { autoRestart(); next(); }
9  
10  
svoid next {
11  
  disableButton(btnNext);
12  
  id = randomImageServerID();
13  
  thread {
14  
    try {
15  
      BufferedImage img = loadImage2_progressBar(id);
16  
      bool first = is == null;
17  
      S name = getSnippetTitle(id);
18  
      is = showImage_centered(is, name + " - " + id, img);
19  
      if (first) {
20  
        addToWindowWithMargin(is, lblText = jcenteredboldlabel(name));
21  
        addToWindow(is, withTopMargin(jcenteredline(focusLater(btnNext = jbutton("Next image", f next)))));
22  
      }
23  
      setText(lblText, name);
24  
      centerPackedFrame(is);
25  
    } finally {
26  
      enableButton(btnNext);
27  
    }
28  
  }
29  
}

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: 623 / 2321
Version history: 18 change(s)
Referenced in: [show references]