วิธี Redirect I/O console
PrintStream myPrintStream = new PrintStream(new myOutput()); System.setOut(myPrintStream); System.setErr(myPrintStream); ... class myOutput extends OutputStream { public void write(int c) { char a[] = new char[1]; a[0] = (char)c; myProgram.this.myTextArea.append(new String(s)); } |