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

!7

static long timeout = 5000;
static int maxEntries = 10;

static AutoComboBox3 box;
static JComboBox cbAction;
static JTextArea taChat;

p-noconsole {
  autoRestart();
  smartBot_autoComplete_defaultMaxEntries = maxEntries;
  smartBot_autoComplete_defaultHardTimeout = timeout;
  box = autoComboBox3(f smartBot_autoComplete);
  centerComboBox(box);
  setFontSize(box, 20);
  setComboBoxListFontSize(box, 20);
  cbAction = jcombobox(
    "Say in Smart Bot's Chat",
    "Say in Stefan's Chat",
    "Open topic in browser");
  onEnterWithClose(box, f doIt);
  taChat = jtextarea();
  setFontSize(taChat, 16);
  showCenterFrame(800, 600,
    centerAndSouth(withMargin(withTitle("Smart Bot's Chat", taChat)),
      centerAndEast(box, jline(cbAction, jbutton("OK", f doIt)))));
  awtLater(box, 500, r { focus(box) });
  
  smartBotsChat_onLine_chatMsg(10, voidfunc(ChatMsg m) {
    appendToTextAreaAndMoveCaret(taChat, (m.botMark ? "[BOT]" : "[USER]") + "\n" + rtrim(m.text) + "\n\n");
  });
}

sS input() { ret getText(box); }

svoid doIt {
  S action = getText(cbAction);
  S s = input();
  if (eqic(action, "Say in Smart Bot's Chat")) {
    if (!postToSmartBotsChat_user(s)) infoBox("!*&$");
  } else if (eqic(action, "Say in Stefan's Chat")) {
    if (!postToStefansChat_user(s)) infoBox("!*&$");
  } else
    openPlatformBrowser(smartBot_topicLink(s));
}

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: 501 / 19922
Version history: 20 change(s)
Referenced in: [show references]