Passing DOS output to a text frame...

I have the following code in an application class that has a text window:

public void format_textCommand( Frame fr )

JavaParser parser;

try {
parser = new JavaParser( new fr.getTitle() ) );
} catch ( e) {
System.err.println("Java Parser Version 1.1:  File " + fr.getTitle() + " not found.");
try {
Node root = parser.CompilationUnit();
parser = null;
System.err.println("Java Parser Version 1.1:  Java program parsed " + "successfully.");
theChoice.setText( "" );
theChoice.setText( root.accept( new PrettyPrinter() ) );
} catch (ParseException e) {
System.err.println("Java Parser Version 1.1:  Encountered errors " + "during parse." + e);

My question is:

How do I pass root.accept( new PrettyPrinter() ), which sends output to a DOS window, to my text window (text window object is theChoice.setText( something ), for example).

Thank you.
Who is Participating?
ashishagarwalConnect With a Mentor Commented:
You can use setIn() and setOut() methods of the java.lang.System class to redirect the Input/Output streams to teh streams of your choice..

this should do what is reqiured by you..

best of luck!
You can't get the output going to the OutputStream (or PrintStream) System.out.
PrettyPrinter() method is probably written by you, or by a third party. If source code for PrettyPrinter() is not available, there is not much you can do about it; unless you write something like that yourself. If you have written it yourself, then you can do somethings that I can help. I have a strong feeling that PrettyPrinter is not a class you have written. Let me know if you have the source code of PrettyPrinter. I can help.


All Courses

From novice to tech pro — start learning today.