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)

abstract sclass DynPrintLog extends DynModule {
  transient JTextArea ta;
  transient Lock updatePrintLog_lock = lock();
  transient StringBuffer actualPrintLog;
  
  visualize {
    JComponent section = jSection("Log", ta = moveCaretToEnd(typeWriterTextArea_noUndo(getPrintLog())));
    componentPopupMenuItem(section, "Clear", rEnter dm_clearModulePrintLog);
    ret awtEvery(section, 500, r updatePrintLog);
  }
  
  void updatePrintLog {
    // TODO: optimize
    lock updatePrintLog_lock;
    if (ta != null) setText(ta, getPrintLog());
  }
  
  JTextArea myPrintLogComponent() { ret ta; }
  
  void enableWordWrap {
    enableWordWrapForTextArea(ta);
  }
  
  S getPrintLog() {
    if (actualPrintLog == null) {
      if (printToModule())
        actualPrintLog = _printLog;
      else
        actualPrintLog = liveLocalPrintLog_realMC(this);
    }
    ret str(actualPrintLog);
  }
}

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: 132 / 163
Referenced in: [show references]