Download Jar. Uses 3874K of libraries. Click here for Pure Java version (6440L/45K).
1 | !7 |
2 | |
3 | p-noconsole { |
4 | final JComboBox cbBot = currentBotsComboBox(); |
5 | final JTextField tfMsg = jtextfield(); |
6 | final JTextField tfResult = standardTextFieldPopupMenu(juneditabletextfield()); |
7 | final JLabel lblTiming = jrightalignedlabel(); |
8 | final JLabel lblBot = jlabel(); |
9 | final JLabel lblMessageSent = jlabel(); |
10 | |
11 | setFrameWidth(800, showFormTitled("Send message to bot", |
12 | jrightalignedlabel("Bot"), botSelector_withRefresh(cbBot), |
13 | jrightalignedlabel("Message"), tfMsg, |
14 | |
15 | "", lblMessageSent, |
16 | "", lblBot, |
17 | jrightalignedlabel("Result"), tfResult, |
18 | "", lblTiming, |
19 | "", jbutton("Send", r { |
20 | S bot = getText(cbBot); |
21 | print("Bot: " + bot); |
22 | fS address = botSelector_getAddress(cbBot); |
23 | print("Address: " + bot); |
24 | if (empty(address)) ret; |
25 | fS msg = getText(tfMsg); |
26 | setText(lblMessageSent, "Sent message: " + msg); |
27 | setText(lblBot, "To bot: " + bot); |
28 | setText(tfResult, "Sending..."); |
29 | thread "Send" { |
30 | long time = sysNow(); |
31 | try { |
32 | S answer = send(address, msg); |
33 | S a = shorten(answer, 10000); |
34 | setText(tfResult, eq(answer, a) ? answer : "(shortened) " + a); |
35 | } catch e { |
36 | setText(tfResult, "(Error) " + getInnerMessage(e)); |
37 | } |
38 | setText(lblTiming, (sysNow()-time) + " ms"); |
39 | } |
40 | }))); |
41 | |
42 | //swing { addActionListener(cbBot, r { print("sel=" + cbBot.getSelectedItem()) }); } |
43 | } |
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1009798 |
Snippet name: | Swing: Send message to bot [OK] |
Eternal ID of this version: | #1009798/28 |
Text MD5: | 2639e4d970b79ad1450e6a3c0854ea4b |
Transpilation MD5: | 2f4f099f835a636267ce5219ef22b85c |
Author: | stefan |
Category: | javax / talking robots / gui |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-08-26 20:32:56 |
Source code size: | 1475 bytes / 43 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 631 / 1424 |
Version history: | 27 change(s) |
Referenced in: | [show references] |