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)

1  
static void clearConsole() {
2  
  if (!isAWTThread())
3  
    sleep(111); // SHOULD clear the system.out buffer
4  
  pcall {
5  
    swingAndWait(r {
6  
      O console = getOpt(javax(), "console");
7  
      if (console != null) {
8  
        call(getFirstNonNullField(console, "textArea", "logView"), "setText", "");
9  
        set(console, "buf", new StringBuffer);
10  
      }
11  
    });
12  
  }
13  
}

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: 526 / 540
Version history: 6 change(s)
Referenced in: [show references]