1 | static class LogView extends JScrollPane { |
2 | JTextArea textArea; |
3 | |
4 | *() { |
5 | textArea = new JTextArea; |
6 | textArea.setEditable(false); |
7 | setViewportView(textArea); |
8 | } |
9 | |
10 | // thread safe |
11 | public void logText(final String text) { |
12 | awt { |
13 | textArea.append(text); |
14 | |
15 | // todo: scroll? |
16 | } |
17 | } |
18 | |
19 | // thread safe |
20 | void print(String text) { |
21 | logText(text); |
22 | } |
23 | |
24 | // log some pure text and add a line feed |
25 | // thread safe |
26 | public void println(String line) { |
27 | logText(line + "\n"); |
28 | } |
29 | |
30 | // thread safe |
31 | public void clear() { |
32 | awt { textArea.setText(""); } |
33 | } |
34 | } |
Began life as a copy of #1000815
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1000820 |
Snippet name: | LogView based on JTextArea |
Eternal ID of this version: | #1000820/1 |
Text MD5: | 54fb7e868e2a4b3188e6ffb08fb9734e |
Author: | stefan |
Category: | |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-08-28 20:37:01 |
Source code size: | 622 bytes / 34 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 648 / 1141 |
Referenced in: | [show references] |