-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathTextAreaPrintStream.java
More file actions
42 lines (34 loc) · 1.06 KB
/
TextAreaPrintStream.java
File metadata and controls
42 lines (34 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import java.io.OutputStream;
import java.io.PrintStream;
import javafx.scene.control.TextArea;
public class TextAreaPrintStream extends PrintStream {
//The TextArea to which the output stream will be redirected.
private TextArea status;
/**
* Method TextAreaPrintStream
* The constructor of the class.
* @param the TextArea to which the output stream will be redirected.
* @param a standard output stream (needed by super method)
**/
public TextAreaPrintStream(TextArea area, OutputStream out) {
super(out);
status = area;
}
/**
* Method println
* @param the String to be output in the TextArea textArea (private
* attribute of the class).
* After having printed such a String, prints a new line.
**/
public void println(String string) {
status.appendText(string+"\n");
}
/**
* Method print
* @param the String to be output in the TextArea textArea (private
* attribute of the class).
**/
public void print(String string) {
status.appendText(string);
}
}