Solved

Passing DOS output to a text frame...

Posted on 1998-02-26
2
232 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
ID: 1233264
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
ID: 1233265
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 Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
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…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

685 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