jTracer  1.03
Stack trace visualization tool
void org.libcsdbg.jtracer.LogPane.append ( final String  ln,
final String  tag 
)

Append a line of formatted text.

Parameters
[in]lnthe text
[in]tagthe formatting style identifier
Note
Assuming that only one dispatching thread does all component rendering, there is no need for synchronized method access

Definition at line 108 of file LogPane.java.

Referenced by org.libcsdbg.jtracer.LogPane.appendln().

109  {
110  /* If the rendering is done by the event dispatching thread */
111  if (EventQueue.isDispatchThread()) {
112  try {
113  Document doc = getDocument();
114  int len = doc.getLength();
115  doc.insertString(len, ln, getStyle(tag));
116  setCaretPosition(len + ln.length());
117  }
118 
119  catch (Throwable t) {
120  Registry.debug(t);
121  }
122 
123  return;
124  }
125 
126  /*
127  * If the rendering is done from any other thread, create a Worker task and
128  * register it to be called by the event dispatching thread
129  */
130  class Worker implements Runnable {
131  public void run()
132  {
133  /* The task is to recursively call the same method */
134  append(ln, tag);
135  }
136  }
137 
138  try {
139  SwingUtilities.invokeLater(new Worker());
140  }
141 
142  catch (Throwable t) {
143  Registry.debug(t);
144  }
145  }
void append(final String ln, final String tag)
Append a line of formatted text.
Definition: LogPane.java:108

+ Here is the caller graph for this function: