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

33
LINES

< > BotCompany Repo | #1024214 // DynPrintLog - show program's print log as visualization - old version with JTextArea

JavaX fragment (include)

1  
abstract sclass DynPrintLog extends DynModule {
2  
  transient JTextArea ta;
3  
  transient Lock updatePrintLog_lock = lock();
4  
  transient StringBuffer actualPrintLog;
5  
  
6  
  visualize {
7  
    JComponent section = jSection("Log", ta = moveCaretToEnd(typeWriterTextArea_noUndo(getPrintLog())));
8  
    componentPopupMenuItem(section, "Clear", rEnter dm_clearModulePrintLog);
9  
    ret awtEvery(section, 500, r updatePrintLog);
10  
  }
11  
  
12  
  void updatePrintLog {
13  
    // TODO: optimize
14  
    lock updatePrintLog_lock;
15  
    if (ta != null) setText(ta, getPrintLog());
16  
  }
17  
  
18  
  JTextArea myPrintLogComponent() { ret ta; }
19  
  
20  
  void enableWordWrap {
21  
    enableWordWrapForTextArea(ta);
22  
  }
23  
  
24  
  S getPrintLog() {
25  
    if (actualPrintLog == null) {
26  
      if (printToModule())
27  
        actualPrintLog = _printLog;
28  
      else
29  
        actualPrintLog = liveLocalPrintLog_realMC(this);
30  
    }
31  
    ret str(actualPrintLog);
32  
  }
33  
}

Author comment

Began life as a copy of #1016205

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1024214
Snippet name: DynPrintLog - show program's print log as visualization - old version with JTextArea
Eternal ID of this version: #1024214/1
Text MD5: 2eb459928e88f83d66e3868fd03fca95
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-07-26 12:24:42
Source code size: 921 bytes / 33 lines
Pitched / IR pitched: No / No
Views / Downloads: 208 / 238
Referenced in: [show references]