Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How do I display PrintWriter output in a swing component?  RSS feed

 
Pete WesternHope
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have some third party java that will direct its output to a PrintWriter object for me.
I would like to display the text produced, as it is produced, in a component in my java application.
I don't think there are any real time issues here! I send a command to the program, it processes it and send the output to my PrintWriter.
I just want to capture that output and display it in my app.
ANy help wlecomed!
Thank you
Pete
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Create the PrintWriter that you pass to the third party tool using a PipedWriter. Create a PipedReader on the same pipe and have a dedicated Thread constantly read from the PipedReader and append the text on a TextArea (or whatever component you wish).
 
Pete WesternHope
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much indeed!
I had almost arrived at that conclusion myself - but you have been very helpful - thanks.
Pete
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!