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

1  
!7
2  
3  
static JTextField tf;
4  
static JTextArea textArea;
5  
static ConcurrentEvaluator currentEval;
6  
7  
p-substance {
8  
  showFrame(northAndCenter(tf = jtextfield(), textArea = jtextarea()));
9  
  onEnter(tf, f update);
10  
}
11  
12  
svoid update {
13  
  if (currentEval != null) currentEval.cancelAndWait();
14  
  final new ConcurrentEvaluator eval;
15  
  currentEval = eval;
16  
  eval.add(func { sleepSeconds(1); print("yo"); ret "Hello 2 at " + now(); });
17  
  eval.add(func { busySleepSeconds(1); print("yo busy"); ret "Hello 3 at " + now(); });
18  
  eval.add(func { ret "Hello at " + now(); });
19  
  eval.onNewResult = r { updateResults(eval) };
20  
  eval.start();
21  
}
22  
23  
svoid updateResults(ConcurrentEvaluator eval) {
24  
  setText(textArea, lines(allToString(notNullOnly(eval.results()))));
25  
}
26  
27  
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: 425 / 633
Version history: 20 change(s)
Referenced in: [show references]