proper.gui.core.text
Class JTextAreaPrintStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by java.io.PrintStream
              extended by proper.gui.core.text.JTextAreaPrintStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.Appendable

public class JTextAreaPrintStream
extends java.io.PrintStream

This class enables to redirect the print/println from a ProperObject to a JTextArea.

Version:
$Revision: 1.2 $
Author:
FracPete
See Also:
ProperObject

Constructor Summary
JTextAreaPrintStream(javax.swing.JTextArea area)
          initializes the stream, moveToEnd is set to TRUE
 
Method Summary
 boolean checkError()
          Flush the stream and check its error state - always FALSE!
 void close()
          Close the stream - ignored!
 void flush()
          Flush the stream - ignored!
 boolean getMoveToEnd()
          returns whether we update the caret position and move it always to the end (= TRUE) or not (= FALSE)
 void print(boolean b)
          Print a boolean value.
 void print(char c)
          Print a character.
 void print(char[] s)
          Print an array of characters.
 void print(double d)
          Print a double-precision floating-point number.
 void print(float f)
          Print a floating-point number.
 void print(int i)
          Print an integer.
 void print(long l)
          Print a long integer.
 void print(java.lang.Object obj)
          Print an object.
 void print(java.lang.String s)
          Print a string.
 void println()
          Terminate the current line by writing the line separator string.
 void println(boolean x)
          Print a boolean and then terminate the line.
 void println(char x)
          Print a character and then terminate the line
 void println(char[] x)
          Print an array of characters and then terminate the line.
 void println(double x)
          Print a double and then terminate the line.
 void println(float x)
          Print a float and then terminate the line.
 void println(int x)
          Print an integer and then terminate the line.
 void println(long x)
          Print a long and then terminate the line.
 void println(java.lang.Object x)
          Print an Object and then terminate the line.
 void println(java.lang.String x)
          Print a String and then terminate the line.
 void setMoveToEnd(boolean moveToEnd)
          whether we update the position of the caret each time we print something, i.e.
 void write(byte[] buf, int off, int len)
          Write len bytes from the specified byte array starting at offset off to this stream.
 void write(int b)
          Write the specified byte to this stream.
 
Methods inherited from class java.io.PrintStream
append, append, append, format, format, printf, printf
 
Methods inherited from class java.io.FilterOutputStream
write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JTextAreaPrintStream

public JTextAreaPrintStream(javax.swing.JTextArea area)
initializes the stream, moveToEnd is set to TRUE

Method Detail

setMoveToEnd

public void setMoveToEnd(boolean moveToEnd)
whether we update the position of the caret each time we print something, i.e. move it to the end (= TRUE)


getMoveToEnd

public boolean getMoveToEnd()
returns whether we update the caret position and move it always to the end (= TRUE) or not (= FALSE)


checkError

public boolean checkError()
Flush the stream and check its error state - always FALSE!

Overrides:
checkError in class java.io.PrintStream

close

public void close()
Close the stream - ignored!

Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.PrintStream

flush

public void flush()
Flush the stream - ignored!

Specified by:
flush in interface java.io.Flushable
Overrides:
flush in class java.io.PrintStream

print

public void print(boolean b)
Print a boolean value.

Overrides:
print in class java.io.PrintStream

print

public void print(char c)
Print a character.

Overrides:
print in class java.io.PrintStream

print

public void print(char[] s)
Print an array of characters.

Overrides:
print in class java.io.PrintStream

print

public void print(double d)
Print a double-precision floating-point number.

Overrides:
print in class java.io.PrintStream

print

public void print(float f)
Print a floating-point number.

Overrides:
print in class java.io.PrintStream

print

public void print(int i)
Print an integer.

Overrides:
print in class java.io.PrintStream

print

public void print(long l)
Print a long integer.

Overrides:
print in class java.io.PrintStream

print

public void print(java.lang.Object obj)
Print an object.

Overrides:
print in class java.io.PrintStream

print

public void print(java.lang.String s)
Print a string.

Overrides:
print in class java.io.PrintStream

println

public void println()
Terminate the current line by writing the line separator string.

Overrides:
println in class java.io.PrintStream

println

public void println(boolean x)
Print a boolean and then terminate the line.

Overrides:
println in class java.io.PrintStream

println

public void println(char x)
Print a character and then terminate the line

Overrides:
println in class java.io.PrintStream

println

public void println(char[] x)
Print an array of characters and then terminate the line.

Overrides:
println in class java.io.PrintStream

println

public void println(double x)
Print a double and then terminate the line.

Overrides:
println in class java.io.PrintStream

println

public void println(float x)
Print a float and then terminate the line.

Overrides:
println in class java.io.PrintStream

println

public void println(int x)
Print an integer and then terminate the line.

Overrides:
println in class java.io.PrintStream

println

public void println(long x)
Print a long and then terminate the line.

Overrides:
println in class java.io.PrintStream

println

public void println(java.lang.Object x)
Print an Object and then terminate the line.

Overrides:
println in class java.io.PrintStream

println

public void println(java.lang.String x)
Print a String and then terminate the line.

Overrides:
println in class java.io.PrintStream

write

public void write(byte[] buf,
                  int off,
                  int len)
Write len bytes from the specified byte array starting at offset off to this stream.

Overrides:
write in class java.io.PrintStream

write

public void write(int b)
Write the specified byte to this stream.

Overrides:
write in class java.io.PrintStream