01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.admin.common;
05:
06: import javax.swing.JTextPane;
07: import javax.swing.text.Document;
08:
09: public class TextPaneUpdater implements Runnable {
10: JTextPane m_view;
11: String m_line;
12:
13: static final String LINE_SEP = System.getProperty("line.separator");
14:
15: public TextPaneUpdater(JTextPane view) {
16: m_view = view;
17: }
18:
19: public TextPaneUpdater(JTextPane view, String text) {
20: this (view);
21: setLine(text);
22: }
23:
24: void setLine(String line) {
25: m_line = line;
26: }
27:
28: public void run() {
29: Document doc = m_view.getDocument();
30:
31: try {
32: doc.insertString(doc.getLength(), m_line + LINE_SEP, null);
33: m_view.setCaretPosition(doc.getLength() - 1);
34: } catch (Exception e) {/**/
35: }
36: }
37: }
|