Contents | Package | Class | Tree | Deprecated | Index | Help
PREV | NEXT SHOW LISTS | HIDE LISTS

Class mil.navy.nps.awt.TextAreaStream

java.lang.Object
    |
    +----java.io.OutputStream
            |
            +----mil.navy.nps.awt.TextAreaStream

public class TextAreaStream
extends java.io.OutputStream
An impressive little bit of code from Lee Crawford at Twofish Technology (crawford@twofish.com). I want to be able to stream outout to a TextArea, much like a debugging console window. This wraps a stream around a TextArea.

This creates a stream that has its output pointing to the textArea. It turns out you only need to override write() to get this to work; the other methods eventually call that.

The JDK 1.1 spec wants you to use PrintWriter over PrintStreams, but (same song, 142nd verse) Netscape is only at the 1.02 stage. I don't think it would be hard to implement this over a PrintWriter. use it as follows: textAreaStream = new TextAreaStream (textArea); outputStream = new PrintStream (textAreaStream); [...] outputStream.println ("Button was pressed.");

Version:
1.0
Author:
Don McGregor ( http://www.stl.nps.navy.mil/~mcgredo)


Field Summary
java.awt.TextArea  textArea
 
 

Constructor Summary
 TextAreaStream(java.awt.TextArea textArea)
 
 

Method Summary
void  write(int b)
 
 
Methods inherited from class java.io.OutputStream
 close, flush, write, write, write
 
Methods inherited from class java.lang.Object
 clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

textArea

protected java.awt.TextArea textArea
Constructor Detail

TextAreaStream

public TextAreaStream(java.awt.TextArea textArea)
Method Detail

write

public void write(int b)
Overrides:
write in class java.io.OutputStream

Contents | Package | Class | Tree | Deprecated | Index | Help
PREV | NEXT SHOW LISTS | HIDE LISTS