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

41
LINES

< > BotCompany Repo | #1006245 - infoMessage - show info message in top-right corner

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (4416L) is out of date.

static bool infoMessage_alwaysOnTop = true;
static double infoMessage_defaultTime = 5.0;

// automatically switches to AWT thread for you
static JWindow infoMessage(S text) {
  ret infoMessage(text, infoMessage_defaultTime);
}

static JWindow infoMessage(final S text, final double seconds) {
  printHidingCredentials(text);
  ret infoMessage_noprint(text, seconds);
}

static JWindow infoMessage_noprint(S text) {
  ret infoMessage_noprint(text, infoMessage_defaultTime);
}

static JWindow infoMessage_noprint(final S _text, final double seconds) {
  fS text = hideCredentials(_text);
  if (empty(text)) null;
  logQuotedWithDate(infoBoxesLogFile(), text); 
  if (isHeadless()) null;
  ret (JWindow) swingAndWait(func {
    JWindow window = makeWindow(infoMessage_makePanel(text));
    window.setSize(300, 150);
    moveToTopRightCorner(window);
    if (infoMessage_alwaysOnTop)
      window.setAlwaysOnTop(true);
    if (vmBus_noObjections shouldShowInfoBox(window, text))
      window.setVisible(true);
    if (seconds != 0)
      disposeWindowAfter(iround(seconds*1000), window);
    ret window;
  });
}

static JWindow infoMessage(Throwable e) {
  //showConsole();
  printStackTrace(e);
  ret infoMessage(exceptionToStringShort(e));
}

Author comment

Began life as a copy of #1003544

download  show line numbers  debug dex  old transpilations   

Travelled to 18 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, imzmzdywqqli, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, 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
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: 581 / 676
Version history: 17 change(s)
Referenced in: [show references]