JTextAreaOutputStream.java :  » IDE » Schmortopf » Schmortopf » OutputManager » Java Open Source

Java Open Source » IDE » Schmortopf 
Schmortopf » Schmortopf » OutputManager » JTextAreaOutputStream.java
package Schmortopf.OutputManager;


  /**
   *  A Writer which is connected to a visible JTextArea.
   */

import java.io.*;
import javax.swing.*;




public class JTextAreaOutputStream extends OutputStream

{
  private final JTextArea textArea;

  public JTextAreaOutputStream( final JTextArea textArea)
  {
    this.textArea = textArea;
  } // Constructor





 /**
  *  The only method to overwrite :
  */
  public void write(int b) throws IOException
  {
    // Just pass it to the textArea :
    final char c = (char)b;
    this.textArea.append( "" + c );
  }


} // JTextAreaPrintStream




java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.