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

27
LINES

< > BotCompany Repo | #1008553 // Do stuff with input [Dummy actions]

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

Uses 3874K of libraries. Click here for Pure Java version (2594L/18K/70K).

!7

static JTextField tf;
static JTextArea textArea;
static ConcurrentEvaluator currentEval;

p-substance {
  showFrame(northAndCenter(tf = jtextfield(), textArea = jtextarea()));
  onEnter(tf, f update);
}

svoid update {
  if (currentEval != null) currentEval.cancelAndWait();
  final new ConcurrentEvaluator eval;
  currentEval = eval;
  eval.add(func { sleepSeconds(1); print("yo"); ret "Hello 2 at " + now(); });
  eval.add(func { busySleepSeconds(1); print("yo busy"); ret "Hello 3 at " + now(); });
  eval.add(func { ret "Hello at " + now(); });
  eval.onNewResult = r { updateResults(eval) };
  eval.start();
}

svoid updateResults(ConcurrentEvaluator eval) {
  setText(textArea, lines(allToString(notNullOnly(eval.results()))));
}

static int coresToUse() { ret max(1, numberOfCores()-1); }

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: #1008553
Snippet name: Do stuff with input [Dummy actions]
Eternal ID of this version: #1008553/21
Text MD5: dc5f00c6718021d93181800fdfd93b7b
Transpilation MD5: 79c09c606fa7767753bd7f7d72f14b8a
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-05-23 21:07:23
Source code size: 825 bytes / 27 lines
Pitched / IR pitched: No / No
Views / Downloads: 493 / 724
Version history: 20 change(s)
Referenced in: [show references]