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

52
LINES

< > BotCompany Repo | #1007453 // Encyclopedia 0.2 [takes commands, dev.]

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

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

1  
!7
2  
3  
static JTextField tf;
4  
static SingleComponentPanel scp;
5  
static Canvas canvas;
6  
static Q q; // action queue
7  
static volatile bool boss; // boss mode (after pressing Escape)
8  
static L<AIConcept> aiConcepts;
9  
10  
!include #1007377 // traits for CirclesAndLines
11  
12  
p-substance-thread {
13  
  aiEnhancements();
14  
  aiConcepts = loadAIConcepts();
15  
  //final S word = getString(random(aiConcepts), /*"name"*/"globalID");
16  
  final S word = "vjyukwvgqzhfcxme HELLO";
17  
  swing {
18  
    q = new Q(true);
19  
    JFrame frame = showFrame(northAndCenter(tf = setTextFieldFontSize(jCenteredTextField(word), 20), scp = new SingleComponentPanel));
20  
    registerEscape(frame, r { boss = true; tf.setText(""); scp.noComponent(); });
21  
    centerFrame(frameInnerSize(frame, 600, 600));
22  
    addMenu(frame, "Menu!", "Show AI Concepts", r { startOrActivate(#1006463) });
23  
    
24  
    onEnterAndNow(tf, r {
25  
      boss = false;
26  
      awt { tf.selectAll(); }
27  
      final S text = getTextTrim(tf);
28  
      q.add(r {
29  
        if (boss) ret;
30  
        long time = sysNow();
31  
        loading {
32  
          final CirclesAndLines cal = renderText(text);
33  
          if (boss) ret;
34  
          awt {
35  
            scp.setComponent(centerAndSouth(cal.makeCanvas(),
36  
              setFont(sansSerifBold(20), jcenteredlabel(text))));
37  
          }
38  
        }
39  
        sleepUntilSys(time+1000); // min display time
40  
      });
41  
    });
42  
    hideConsole();
43  
  }
44  
}
45  
46  
static CirclesAndLines renderText(S s) {
47  
  new Matches m;
48  
  new CirclesAndLines cal;
49  
  if "vjyukwvgqzhfcxme *"
50  
    cal.circle(unquote($1), 0.5, 0.5);
51  
  ret cal;
52  
}

Author comment

Began life as a copy of #1007383

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: #1007453
Snippet name: Encyclopedia 0.2 [takes commands, dev.]
Eternal ID of this version: #1007453/4
Text MD5: 1d67891ef0add2b76ac15f1bee12e89d
Transpilation MD5: a0f244202e5828a95a5c7bc40e940d12
Author: stefan
Category: javax / a.i. / gui
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-09-19 22:39:45
Source code size: 1588 bytes / 52 lines
Pitched / IR pitched: No / No
Views / Downloads: 436 / 958
Version history: 3 change(s)
Referenced in: [show references]