/*
 * Created on May 16, 2005
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package gov.nasa.jsc.plum.PlumUtil;

import java.io.IOException;
import java.io.OutputStream;

import javax.swing.JTextArea;

public class TextAreaOutput extends OutputStream{
    JTextArea text;
    
    public TextAreaOutput(JTextArea text){
        this.text=text;
    }
    
    public void write(int b) throws IOException { // Swap which lines are commented here for speed vs. compatibility.
        text.append(Character.toString((char) b));
//        SwingUtilities.invokeLater(new AsynchWriter(b));
    }

    private class AsynchWriter extends Thread{
        int b;
        public AsynchWriter(int b)
        {
            this.b=b;
        }
        public void run(){
            text.append(Character.toString((char) b));            
        }
    }
}
