(Java Swing) Redirecting System.out.println() calls to a JTextArea?
843807Apr 2 2010 — edited Apr 5 2010Hi,
I've been building a GUI using Java Swing and Netbeans.
I have a lot of calls to System.out.println() throughout my class's in various .java files that I want to redirect to a JTextArea in my top level Swing GUI FrameView.
From inside the new FramView I can output to the logArea by doing a call to logArea.setText("Starting Log");
What I want to do is send all my old System.out.println() calls in various classes to the logArea in the top level Swing GUI Frame.
I've updated all my .java files to include the package for my top level Frame.
QUESTIONS:
1. How do I redirect the output from System.out.pringln() to the logArea if I'm inside a different .java file other then my top level one?
2. How do I access top level variable names such as JCheckBox from other classes without passing the values explicitly? What is the syntax for that? Do I have to add an "extends" to each class?
3. For example, I have a JTextField called URL. Is it better to just explicity pass the JTextField value to my other methods via doing a call such as method(URL.getText()) or can I simply call method() and then from inside the method do a call to URL.getText() somehow?
My main issue is redirecting System.out to the JTextArea.
Thanks
V$h3r
Edited by: Vsh3r on Apr 2, 2010 4:38 PM
Edited by: Vsh3r on Apr 2, 2010 4:39 PM
Edited by: Vsh3r on Apr 2, 2010 4:41 PM