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

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

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

Public Member Functions

 TextAreaWriter (final TextArea textArea)
 
void flush ()
 
void close ()
 
void write (char[] cbuf, int off, int len) throws IOException
 

Static Public Member Functions

static PrintWriter getTextPrintWriter (TextArea textArea)
 Factory method for creating a PrintWriter to print to selected TextArea.
 

Private Attributes

final TextArea textArea
 

Detailed Description

Simple way to "print" to a JTextArea; just say PrintWriter out = new PrintWriter(new TextAreaWriter(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 15 of file TextAreaWriter.java.

Constructor & Destructor Documentation

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

Definition at line 37 of file TextAreaWriter.java.

Member Function Documentation

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

Definition at line 45 of file TextAreaWriter.java.

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

Definition at line 42 of file TextAreaWriter.java.

static PrintWriter fi.jyu.mit.fxgui.TextAreaWriter.getTextPrintWriter ( TextArea  textArea)
inlinestatic

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

Parameters
textAreaarea where to print
Returns
created PrintWriter ready to print to TextArea
Examples:
#import java.io.*;
#import javax.swing.*;
  JTextArea text = new JTextArea();
  PrintWriter tw = TextAreaWriter.getTextPrintWriter(text);
  tw.print("Hyvää");
  tw.print(" ");
  tw.print("päivää!");
  text.getText() === "Hyvää päivää!";

Definition at line 69 of file TextAreaWriter.java.

void fi.jyu.mit.fxgui.TextAreaWriter.write ( char[]  cbuf,
int  off,
int  len 
) throws IOException
inline

Definition at line 48 of file TextAreaWriter.java.

Member Data Documentation

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

Definition at line 17 of file TextAreaWriter.java.


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