Libraryless. Click here for Pure Java version (7785L/44K).
1 | static bool infoMessage_alwaysOnTop = true; |
2 | static double infoMessage_defaultTime = 5.0; |
3 | |
4 | // automatically switches to AWT thread for you |
5 | static JWindow infoMessage(S text) { |
6 | ret infoMessage(text, infoMessage_defaultTime); |
7 | } |
8 | |
9 | static JWindow infoMessage(final S text, final double seconds) { |
10 | printHidingCredentials(text); |
11 | ret infoMessage_noprint(text, seconds); |
12 | } |
13 | |
14 | static JWindow infoMessage_noprint(S text) { |
15 | ret infoMessage_noprint(text, infoMessage_defaultTime); |
16 | } |
17 | |
18 | static JWindow infoMessage_noprint(final S _text, final double seconds) { |
19 | fS text = hideCredentials(_text); |
20 | if (empty(text)) null; |
21 | logQuotedWithDate(infoBoxesLogFile(), text); |
22 | if (isHeadless()) null; |
23 | ret (JWindow) swingAndWait(func { |
24 | JWindow window = makeWindow(infoMessage_makePanel(text)); |
25 | window.setSize(300, 150); |
26 | moveToTopRightCorner(window); |
27 | if (infoMessage_alwaysOnTop) |
28 | window.setAlwaysOnTop(true); |
29 | if (vmBus_noObjections shouldShowInfoBox(window, text)) |
30 | window.setVisible(true); |
31 | if (seconds != 0) |
32 | disposeWindowAfter(iround(seconds*1000), window); |
33 | ret window; |
34 | }); |
35 | } |
36 | |
37 | static JWindow infoMessage(Throwable e) { |
38 | //showConsole(); |
39 | printStackTrace(e); |
40 | ret infoMessage(exceptionToStringShort(e)); |
41 | } |
Began life as a copy of #1003544
download show line numbers debug dex old transpilations
Travelled to 19 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, imzmzdywqqli, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, snaazhdonpnp, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1006245 |
Snippet name: | infoMessage - show info message in top-right corner |
Eternal ID of this version: | #1006245/18 |
Text MD5: | 3d0d18610f05422289c3347a45d45e92 |
Transpilation MD5: | 10874b560d3b73d0bcf0def7015a82db |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-10-27 09:45:40 |
Source code size: | 1279 bytes / 41 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 823 / 1003 |
Version history: | 17 change(s) |
Referenced in: | [show references] |