All Classes Namespaces Files Functions Variables
fi.jyu.mit.fxgui.TextAreaOutputStream Class Reference

Simple way to "print" to a JTextArea; just say PrintStream out = new PrintStream(new TextAreaOutputStream(myTextArea)); Then out.println() et all will all appear in the TextArea. More...

Inheritance diagram for fi.jyu.mit.fxgui.TextAreaOutputStream:

Public Member Functions

 TextAreaOutputStream (final TextArea textArea)
 
void flush ()
 
void close ()
 
void write (int b) throws IOException
 
void write (byte b[], int off, int len) throws IOException
 

Static Public Member Functions

static PrintStream getTextPrintStream (TextArea textArea)
 Factory method for creating a PrintStream to print to selected TextArea.
 

Private Attributes

final TextArea textArea
 

Detailed Description

Simple way to "print" to a JTextArea; just say PrintStream out = new PrintStream(new TextAreaOutputStream(myTextArea)); Then out.println() et all will all appear in the TextArea.

Source: http://javacook.darwinsys.com/new_recipes/14.9betterTextToTextArea.jsp

Definition at line 16 of file TextAreaOutputStream.java.

Constructor & Destructor Documentation

fi.jyu.mit.fxgui.TextAreaOutputStream.TextAreaOutputStream ( final TextArea  textArea)
inline
Parameters
textAreaarea where to write
Examples:
#import java.io.*;
#import javax.swing.*;
  JTextArea text = new JTextArea();
  PrintStream tw = new PrintStream(new TextAreaOutputStream(text));
  tw.print("Hello");
  tw.print(" ");
  tw.print("world!");
  tw.flush();
  text.getText() === "Hello world!";
  text.setText("");
  tw.println("Hello");
  tw.println("world!");
  text.getText() =R= "Hello\\r?\\nworld!\\r?\\n";

Definition at line 40 of file TextAreaOutputStream.java.

Member Function Documentation

void fi.jyu.mit.fxgui.TextAreaOutputStream.close ( )
inline

Definition at line 51 of file TextAreaOutputStream.java.

void fi.jyu.mit.fxgui.TextAreaOutputStream.flush ( )
inline

Definition at line 45 of file TextAreaOutputStream.java.

static PrintStream fi.jyu.mit.fxgui.TextAreaOutputStream.getTextPrintStream ( TextArea  textArea)
inlinestatic

Factory method for creating a PrintStream to print to selected TextArea.

Parameters
textAreaarea where to print
Returns
created PrintStream ready to print to TextArea
Examples:
#import java.io.*;
#import javax.swing.*;
  JTextArea text = new JTextArea();
  PrintStream tw = TextAreaOutputStream.getTextPrintStream(text);
  tw.print("Hyvää"); // skandit toimi
  tw.print(" ");
  tw.print("päivää!");
  text.getText() === "Hyvää päivää!";
  text.setText("");
  tw.print("ä");
  text.getText() === "ä"; 

Definition at line 96 of file TextAreaOutputStream.java.

void fi.jyu.mit.fxgui.TextAreaOutputStream.write ( int  b) throws IOException
inline

Definition at line 54 of file TextAreaOutputStream.java.

void fi.jyu.mit.fxgui.TextAreaOutputStream.write ( byte  b[],
int  off,
int  len 
) throws IOException
inline

Definition at line 72 of file TextAreaOutputStream.java.

Member Data Documentation

final TextArea fi.jyu.mit.fxgui.TextAreaOutputStream.textArea
private

Definition at line 18 of file TextAreaOutputStream.java.


The documentation for this class was generated from the following file: