• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How do I display PrintWriter output in a swing component?

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic