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

35
LINES

< > BotCompany Repo | #1000919 // Swing: Answer a question

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

Libraryless. Click here for Pure Java version (2002L/15K/48K).

1  
!747
2  
3  
m {
4  
  static S answererID = "#1000887";
5  
  static S defaultQuestion = "";
6  
  static S q, answer;
7  
  
8  
  p {
9  
    if (args.length != 0) answererID = smartJoin(args);
10  
    thread { // because slte must be called in non-awt thread
11  
      while (true) {
12  
        S text;
13  
        if (answer != null) {
14  
          text = q + "\n" + formatSnippetID(answererID) + ": " + answer;
15  
          defaultQuestion = q;
16  
        } else
17  
          text = "Hi! What's your question for " + formatSnippetID(answererID) + "?";
18  
        q = slte(text, defaultQuestion);
19  
        if (q == null) {
20  
          print("abort");
21  
          killMyself();
22  
        } else {
23  
          print("Answering: " + q);
24  
          
25  
          try {
26  
            Class prog = hotwire(answererID);
27  
            set(prog, "question", q);
28  
            callMain(prog);
29  
            answer = (S) get(prog, "answer");
30  
          } catch (Throwable e) { popup(e); }
31  
        }
32  
      }
33  
    }
34  
  }
35  
}

Author comment

Began life as a copy of #1000917

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1000919
Snippet name: Swing: Answer a question
Eternal ID of this version: #1000919/1
Text MD5: 807458924490267759b9e558441256ee
Transpilation MD5: 6a367f645aa53adcf3bd6e12bc2a5938
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-09-08 20:06:20
Source code size: 963 bytes / 35 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 689 / 728
Referenced in: [show references]