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

!7

static JTextField tf;
static SingleComponentPanel scp;
static Canvas canvas;
static Q q; // action queue
static volatile bool boss; // boss mode (after pressing Escape)
static L<AIConcept> aiConcepts;

!include #1007377 // traits for CirclesAndLines

p-substance-thread {
  aiEnhancements();
  aiConcepts = loadAIConcepts();
  //final S word = getString(random(aiConcepts), /*"name"*/"globalID");
  final S word = "vjyukwvgqzhfcxme HELLO";
  swing {
    q = new Q(true);
    JFrame frame = showFrame(northAndCenter(tf = setTextFieldFontSize(jCenteredTextField(word), 20), scp = new SingleComponentPanel));
    registerEscape(frame, r { boss = true; tf.setText(""); scp.noComponent(); });
    centerFrame(frameInnerSize(frame, 600, 600));
    addMenu(frame, "Menu!", "Show AI Concepts", r { startOrActivate(#1006463) });
    
    onEnterAndNow(tf, r {
      boss = false;
      awt { tf.selectAll(); }
      final S text = getTextTrim(tf);
      q.add(r {
        if (boss) ret;
        long time = sysNow();
        loading {
          final CirclesAndLines cal = renderText(text);
          if (boss) ret;
          awt {
            scp.setComponent(centerAndSouth(cal.makeCanvas(),
              setFont(sansSerifBold(20), jcenteredlabel(text))));
          }
        }
        sleepUntilSys(time+1000); // min display time
      });
    });
    hideConsole();
  }
}

static CirclesAndLines renderText(S s) {
  new Matches m;
  new CirclesAndLines cal;
  if "vjyukwvgqzhfcxme *"
    cal.circle(unquote($1), 0.5, 0.5);
  ret cal;
}

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: 561 / 1239
Version history: 3 change(s)
Referenced in: #1007208 - AI Concepts from tvejysmllsmz
#1007214 - AI Concepts from wtqryiryparv
#1007558 - AI Concepts from jtubtzbbkimh
#1007569 - AI Concepts from jtubtzbbkimh