Solved

Passing DOS output to a text frame...

Posted on 1998-02-26
2
223 Views
Last Modified: 2006-11-17
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 java.io.FileInputStream( fr.getTitle() ) );
} catch (java.io.FileNotFoundException e) {
System.err.println("Java Parser Version 1.1:  File " + fr.getTitle() + " not found.");
return;
}
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.
0
Comment
Question by:loyaliser
2 Comments
 

Expert Comment

by:kaleemaziz
Comment Utility
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.
Regards.

                                                     Kaleem.

0
 
LVL 1

Accepted Solution

by:
ashishagarwal earned 50 total points
Comment Utility
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!
ashish
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
The viewer will learn how to implement Singleton Design Pattern in Java.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now