Download Jar. Libraryless. Click here for Pure Java version (15772L/113K).
1 | !7 |
2 | |
3 | sS background = #1009946; |
4 | static IVar<S> text; |
5 | static JTextField tf; |
6 | static JDesktopPane desktop; |
7 | static Q q = startQ(); |
8 | |
9 | p-nimbus { |
10 | text = persistentVar("Text", "Show me a window!"); |
11 | |
12 | onEnter(tf = bindTextFieldToVar(text, jcenteredtextfield(text!)), f go); |
13 | desktop = jTiledBackgroundDesktopPane(background); |
14 | autoFixDesktopPane(desktop); |
15 | addFullSizeComponent(desktop, jtransparent_recursive(jTopCenter(hstackWithSpacing(withTopMargin(60, |
16 | hstackWithSpacing(jMinWidth(400, setFontSize(30, tf)), |
17 | jbutton("OK", f go)/*, |
18 | jbutton("Exit", f cleanKill)*/)))))); |
19 | cleanExitOnFrameClose(showFrame/*MaximizedFrame*/(desktop)); |
20 | focus(tf); |
21 | } |
22 | |
23 | svoid go { callStaticAnswerMethod(getText(tf)); } |
24 | |
25 | answer { |
26 | fS _s = s; |
27 | q.add(r { answer_impl(_s) }); |
28 | } |
29 | |
30 | svoid answer_impl(S s) { |
31 | new Matches m; |
32 | |
33 | Web web = webFromTriples("User typed", "", quote(s)); |
34 | postSoftwareMadeWeb(web); |
35 | |
36 | if "show me a window" |
37 | swing { |
38 | addInternalFrame(desktop, "Here it is.", random(100, desktop.getWidth()-100-300), 400, 300, 200); |
39 | } |
40 | |
41 | L<WebNode> nodes = web_allOperands(indexedNodes("Things to do on user input")); |
42 | for (WebNode node : nodes) { |
43 | S fname = "action_" + camelCase(web_text(node)); |
44 | if (isStandardFunction(fname)) { |
45 | print("Can call: " + fname); |
46 | infoBox("Calling " + fname); |
47 | Class c = loadFunctions_cached('action_text, fname); |
48 | call(c, 'action_text, s); |
49 | call(c, fname); |
50 | } else |
51 | print("Can't call: " + web_text(node) + " / " + fname); |
52 | } |
53 | } |
Began life as a copy of #1009955
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: | #1010671 |
Snippet name: | Fancy Control Frame v2 [dev.] |
Eternal ID of this version: | #1010671/7 |
Text MD5: | 4377a1b2aa7e7d8b6f19bfec4cdf4180 |
Transpilation MD5: | 11e269c923b10fabc43cee2baad16b76 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-09-24 18:17:48 |
Source code size: | 1572 bytes / 53 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 598 / 1394 |
Version history: | 6 change(s) |
Referenced in: | [show references] |