1 21 package proguard.gui; 22 23 import java.io.*; 24 25 import javax.swing.*; 26 27 28 33 class TextAreaOutputStream extends FilterOutputStream implements Runnable 34 { 35 private JTextArea textArea; 36 37 38 public TextAreaOutputStream(JTextArea textArea) 39 { 40 super(new ByteArrayOutputStream()); 41 42 this.textArea = textArea; 43 } 44 45 46 48 public void flush() throws IOException 49 { 50 super.flush(); 51 52 SwingUtil.invokeAndWait(this); 54 } 55 56 57 59 public synchronized void run() 60 { 61 ByteArrayOutputStream out = (ByteArrayOutputStream)super.out; 62 63 String text = out.toString(); 65 if (text.length() > 0) 66 { 67 textArea.append(text); 69 70 out.reset(); 72 } 73 } 74 } 75 | Popular Tags |