how can i copy/view the console into a textArea in a gui/JFrame?
EDIT: more information
i want to copy/view the console of the program thats running into the gui or remove the console and make it show in a gui/Jframe...
Printable View
how can i copy/view the console into a textArea in a gui/JFrame?
EDIT: more information
i want to copy/view the console of the program thats running into the gui or remove the console and make it show in a gui/Jframe...
Something like this should do the trick
Code:import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import javax.swing.JFrame;
import javax.swing.JTextField;
public class Test {
public static void main(final String[] args) {
final JFrame frm = new JFrame();
final JTextField textField = new JTextField();
System.setOut(new PrintStream(new OutputStream() {
@Override
public void write(final int b) throws IOException {
textField.setText(textField.getText() + (char) b);
}
}));
frm.add(textField);
frm.setSize(200, 200);
System.out.println("Welcome home");
frm.setVisible(true);
}
}
i figured another way, so instead of copying all the console i just did textArea3.append then the text where everything i needed was so instead of taking all i just took what i needed, by coping to misc.println and add a textArea3.append instead. but thats for help anyways.