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

46
LINES

< > BotCompany Repo | #1013479 // Smart Bot GUI v2

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

Download Jar. Uses 3874K of libraries. Click here for Pure Java version (8387L/58K).

1  
!7
2  
3  
static long timeout = 5000;
4  
static int maxEntries = 10;
5  
6  
static AutoComboBox3 box;
7  
static JComboBox cbAction;
8  
static JTextArea taChat;
9  
10  
p-noconsole {
11  
  autoRestart();
12  
  smartBot_autoComplete_defaultMaxEntries = maxEntries;
13  
  smartBot_autoComplete_defaultHardTimeout = timeout;
14  
  box = autoComboBox3(f smartBot_autoComplete);
15  
  centerComboBox(box);
16  
  setFontSize(box, 20);
17  
  setComboBoxListFontSize(box, 20);
18  
  cbAction = jcombobox(
19  
    "Say in Smart Bot's Chat",
20  
    "Say in Stefan's Chat",
21  
    "Open topic in browser");
22  
  onEnterWithClose(box, f doIt);
23  
  taChat = jtextarea();
24  
  setFontSize(taChat, 16);
25  
  showCenterFrame(800, 600,
26  
    centerAndSouth(withMargin(withTitle("Smart Bot's Chat", taChat)),
27  
      centerAndEast(box, jline(cbAction, jbutton("OK", f doIt)))));
28  
  awtLater(box, 500, r { focus(box) });
29  
  
30  
  smartBotsChat_onLine_chatMsg(10, voidfunc(ChatMsg m) {
31  
    appendToTextAreaAndMoveCaret(taChat, (m.botMark ? "[BOT]" : "[USER]") + "\n" + rtrim(m.text) + "\n\n");
32  
  });
33  
}
34  
35  
sS input() { ret getText(box); }
36  
37  
svoid doIt {
38  
  S action = getText(cbAction);
39  
  S s = input();
40  
  if (eqic(action, "Say in Smart Bot's Chat")) {
41  
    if (!postToSmartBotsChat_user(s)) infoBox("!*&$");
42  
  } else if (eqic(action, "Say in Stefan's Chat")) {
43  
    if (!postToStefansChat_user(s)) infoBox("!*&$");
44  
  } else
45  
    openPlatformBrowser(smartBot_topicLink(s));
46  
}

Author comment

Began life as a copy of #1013360

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: #1013479
Snippet name: Smart Bot GUI v2
Eternal ID of this version: #1013479/21
Text MD5: ccfff603d1995bbfd0af2aa55a47a104
Transpilation MD5: ed8caf7e80ae9cd638887179f3efceb5
Author: stefan
Category: javax / gui
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-01-08 09:36:28
Source code size: 1401 bytes / 46 lines
Pitched / IR pitched: No / No
Views / Downloads: 394 / 19689
Version history: 20 change(s)
Referenced in: [show references]