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

53
LINES

< > BotCompany Repo | #1010671 // Fancy Control Frame v2 [dev.]

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

Download Jar. Libraryless. Click here for Pure Java version (15772L/113K).

!7

sS background = #1009946;
static IVar<S> text;
static JTextField tf;
static JDesktopPane desktop;
static Q q = startQ();

p-nimbus {
  text = persistentVar("Text", "Show me a window!");
  
  onEnter(tf = bindTextFieldToVar(text, jcenteredtextfield(text!)), f go);
  desktop = jTiledBackgroundDesktopPane(background);
  autoFixDesktopPane(desktop);
  addFullSizeComponent(desktop, jtransparent_recursive(jTopCenter(hstackWithSpacing(withTopMargin(60,
    hstackWithSpacing(jMinWidth(400, setFontSize(30, tf)),
      jbutton("OK", f go)/*,
      jbutton("Exit", f cleanKill)*/))))));
  cleanExitOnFrameClose(showFrame/*MaximizedFrame*/(desktop));
  focus(tf);
}

svoid go { callStaticAnswerMethod(getText(tf)); }

answer {
  fS _s = s;
  q.add(r { answer_impl(_s) });
}

svoid answer_impl(S s) {
  new Matches m;
  
  Web web = webFromTriples("User typed", "", quote(s));
  postSoftwareMadeWeb(web);
  
  if "show me a window"
    swing {
      addInternalFrame(desktop, "Here it is.", random(100, desktop.getWidth()-100-300), 400, 300, 200);
    }
    
  L<WebNode> nodes = web_allOperands(indexedNodes("Things to do on user input"));
  for (WebNode node : nodes) {
    S fname = "action_" + camelCase(web_text(node));
    if (isStandardFunction(fname)) {
      print("Can call: " + fname);
      infoBox("Calling " + fname);
      Class c = loadFunctions_cached('action_text, fname);
      call(c, 'action_text, s);
      call(c, fname);
    } else
      print("Can't call: " + web_text(node) + " / " + fname);
  }
}

Author comment

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: 596 / 1388
Version history: 6 change(s)
Referenced in: [show references]