Solved

Passing DOS output to a text frame...

Posted on 1998-02-26
2
233 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
numbers ascending pyramid 101 264
java imports not found 4 71
Eclipse for Java EE development 2 68
Java array 10 87
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
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…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

739 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