as the title said i want to show the console log to the user of my application
I come with this
package utility;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import javafx.scene.control.TextArea;
public class Log {
public static void checkLog(TextArea txt) throws IOException {
Console console = new Console(txt);
PrintStream ps = new PrintStream(console, true);
System.setOut(ps);
System.setErr(ps);
for (char c : "some text".toCharArray()) {
console.write(c);
}
ps.close();
}
public static class Console extends OutputStream {
private TextArea output;
public Console(TextArea ta) {
this.output = ta;
}
@Override
public void write(int i) throws IOException {
output.appendText(String.valueOf((char) i));
}
}
}
And i put the thing in
TextArea txt = new TextArea();
Log.checkLog(txt);
Scene scene = new Scene(txt, 700, 500);
when i clic on my button to show my stage with my TextArea in it ... the only thing that i see is : "some text" without quote ...
But what i want is all my System.out.print
Did i miss something ?
Thanks for your answer ...