Download Jar. Uses 3874K of libraries. Click here for Pure Java version (12782L/90K).
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 | aiConcepts = loadAIConcepts(); |
14 | //final S word = getString(random(aiConcepts), /*"name"*/"globalID"); |
15 | final S word = "paul + marie"; |
16 | swing { |
17 | q = new Q(true); |
18 | JFrame frame = showFrame(northAndCenter(tf = setTextFieldFontSize(jCenteredTextField(word), 20), scp = new SingleComponentPanel)); |
19 | registerEscape(frame, r { boss = true; tf.setText(""); scp.noComponent(); }); |
20 | centerFrame(frameInnerSize(frame, 600, 600)); |
21 | addMenu(frame, "Menu!", "Show AI Concepts", r { startOrActivate(#1006463) }); |
22 | |
23 | onEnterAndNow(tf, r { |
24 | boss = false; |
25 | awt { tf.selectAll(); } |
26 | final S text = getTextTrim(tf); |
27 | q.add(r { |
28 | if (boss) ret; |
29 | long time = sysNow(); |
30 | loading { |
31 | final CirclesAndLines cal = renderText(text); |
32 | if (boss) ret; |
33 | awt { |
34 | scp.setComponent(centerAndSouth( |
35 | /*jscroll_centered*/(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 text) { |
47 | if (possibleGlobalID(text)) { |
48 | AIConcept c = findWhere(aiConcepts, globalID := text); |
49 | if (c != null) { |
50 | print("Have concept (" + c.globalID + " - " + c.name + ")"); |
51 | ret renderConcept(c); |
52 | } |
53 | } |
54 | |
55 | new CirclesAndLines cal; |
56 | for (S s : splitAtPlus(text)) cal.circle_autoVis(s, 0.5, 0.5); |
57 | autoPositionCircles(cal); |
58 | ret cal; |
59 | } |
60 | |
61 | static CirclesAndLines renderConcept(AIConcept c) { |
62 | new CirclesAndLines cal; |
63 | BufferedImage img = getConceptImage(c); |
64 | Circle cc; |
65 | if (img != null) |
66 | cc = cal.circle(img, 0.5, 0.5, c.name); |
67 | else |
68 | cc = cal.circle_autoVis(c.name, 0.5, 0.5); |
69 | cc.addTrait(c.globalID); |
70 | ret cal; |
71 | } |
Began life as a copy of #1007146
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xinetxnxrdbb
No comments. add comment
Snippet ID: | #1007383 |
Snippet name: | Encyclopedia 0.1 |
Eternal ID of this version: | #1007383/30 |
Text MD5: | 917cf667dd5b13cd0875456d12176459 |
Transpilation MD5: | f458607df671d0bf90c2727510e7ed5d |
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:40:11 |
Source code size: | 2140 bytes / 71 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 688 / 1514 |
Version history: | 29 change(s) |
Referenced in: | [show references] |