sclass ImageMachine { JTextField tf; SingleComponentPanel scp; ImageSurface is; Q q; volatile bool boss; // boss mode (after pressing Escape) void start() { final S word = randomEnglishWord(); swing { q = new Q(true); showMaximizedFrame("Automatic Image Machine!", northAndCenter(tf = setTextFieldFontSize(jCenteredTextField(word), 20), scp = new SingleComponentPanel)); // Escape = Boss Key! registerEscape(getFrame(tf), r { boss = true; tf.setText(""); scp.noComponent(); }); onEnterAndNow(tf, r { boss = false; awt { tf.selectAll(); } final S text = getTextTrim(tf); q.add(r { if (boss) ret; long time = sysNow(); loading { final BufferedImage img = quickVisualize(text); if (boss) ret; awt { newImage(text, img); } } sleepUntilSys(time+1000); // min display time }); }); hideConsole(); } } void newImage(S text, BufferedImage img) { JLabel lbl = jcenteredlabel(text); lbl.setFont(sansSerifBold(20)); scp.setComponent(centerAndSouth( jscroll_centered(is = new ImageSurface(img)), lbl); awt { is.zoomToWindow(); } } }
Began life as a copy of #1007146
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: | #1007154 |
Snippet name: | class ImageMachine |
Eternal ID of this version: | #1007154/3 |
Text MD5: | 613af1a6fd66a2d4def810c7a80714fb |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-03-08 01:03:55 |
Source code size: | 1323 bytes / 46 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 413 / 609 |
Version history: | 2 change(s) |
Referenced in: | #1007155 - Automatic Image Machine With Average Color Analysis |