01: package net.xoetrope.builder.editor;
02:
03: import javax.swing.JTextArea;
04: import java.awt.Dimension;
05: import javax.swing.JScrollPane;
06: import java.awt.BorderLayout;
07: import net.xoetrope.debug.XLogListener;
08: import net.xoetrope.debug.DebugLogger;
09: import javax.swing.SwingUtilities;
10:
11: /**
12: * A message for build and other messages
13: * <p> Copyright (c) Xoetrope Ltd., 2002-2003</p>
14: * <p> $Revision: 1.3 $</p>
15: */
16: public class XMessageArea extends JScrollPane implements XLogListener {
17: JTextArea textArea;
18:
19: public XMessageArea() {
20: DebugLogger.setLogListener(this );
21: textArea = new JTextArea();
22: setViewportView(textArea);
23: }
24:
25: public Dimension getPreferredSize() {
26: return new Dimension(200, 170);
27: }
28:
29: public void addMessage(final String line) {
30: SwingUtilities.invokeLater(new Runnable() {
31: public void run() {
32: textArea.append(line + "\n");
33: }
34: });
35: }
36:
37: public void addError(final String line) {
38: SwingUtilities.invokeLater(new Runnable() {
39: public void run() {
40: textArea.append(line + "\n");
41: }
42: });
43: }
44:
45: public void clear() {
46: textArea.setText("");
47: }
48: }
|