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...
|
static PrintStream | getTextPrintStream (TextArea textArea) |
| Factory method for creating a PrintStream to print to selected TextArea.
|
|
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.
fi.jyu.mit.fxgui.TextAreaOutputStream.TextAreaOutputStream |
( |
final TextArea |
textArea | ) |
|
|
inline |
- Parameters
-
textArea | area 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.
void fi.jyu.mit.fxgui.TextAreaOutputStream.close |
( |
| ) |
|
|
inline |
void fi.jyu.mit.fxgui.TextAreaOutputStream.flush |
( |
| ) |
|
|
inline |
static PrintStream fi.jyu.mit.fxgui.TextAreaOutputStream.getTextPrintStream |
( |
TextArea |
textArea | ) |
|
|
inlinestatic |
Factory method for creating a PrintStream to print to selected TextArea.
- Parameters
-
textArea | area 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 |
void fi.jyu.mit.fxgui.TextAreaOutputStream.write |
( |
byte |
b[], |
|
|
int |
off, |
|
|
int |
len |
|
) |
| throws IOException |
|
inline |
final TextArea fi.jyu.mit.fxgui.TextAreaOutputStream.textArea |
|
private |
The documentation for this class was generated from the following file: