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

13
LINES

< > BotCompany Repo | #1004964 // clearConsole - best run on non-AWT thread

JavaX fragment (include)

static void clearConsole() {
  if (!isAWTThread())
    sleep(111); // SHOULD clear the system.out buffer
  pcall {
    swingAndWait(r {
      O console = getOpt(javax(), "console");
      if (console != null) {
        call(getFirstNonNullField(console, "textArea", "logView"), "setText", "");
        set(console, "buf", new StringBuffer);
      }
    });
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1004964
Snippet name: clearConsole - best run on non-AWT thread
Eternal ID of this version: #1004964/7
Text MD5: 90ca8075cc6903370d53b3c0b5fcdc8e
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-06-20 23:38:06
Source code size: 374 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 524 / 537
Version history: 6 change(s)
Referenced in: [show references]