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

44
LINES

< > TinyBrain | #1007146 - Automatic Image Machine

JavaX source code [tags: use-pretranspiled] - run with: x30.jar - homepage

Uses 2245K of libraries. Click here for Pure Java version (7369L/53K/183K).

!7

static JTextField tf;
static SingleComponentPanel scp;
static ImageSurface is;
static Q q;
static volatile bool boss; // boss mode (after pressing Escape)

p-substance-thread {
  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 {
            JLabel lbl = jcenteredlabel(text);
            lbl.setFont(sansSerifBold(20));
            scp.setComponent(centerAndSouth(
              jscroll_centered(is = new ImageSurface(img)),
              lbl);
            awt { is.zoomToWindow(); }
          }
        }
        sleepUntilSys(time+1000); // min display time
      });
    });
    hideConsole();
  }
}

download  show line numbers  debug dex   

Travelled to 3 computer(s): cfunsshuasjs, tvejysmllsmz, xinetxnxrdbb

No comments. add comment

Snippet ID: #1007146
Snippet name: Automatic Image Machine
Eternal ID of this version: #1007146/28
Text MD5: 5f5bc29345da29286b7d87e3c997389f
Transpilation MD5: 4914244fc1dd377a3ec0a1b3bb135b7a
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-03-26 11:17:16
Source code size: 1259 bytes / 44 lines
Pitched / IR pitched: No / No
Views / Downloads: 179 / 229
Version history: 27 change(s)
Referenced in: [show]