Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #23791
| From | Daniel Pitts <newsgroup.nospam@virtualinfinity.net> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: How to send console progress information to gui |
| References | <6aaa6aa4-440f-44fc-8efe-a06f6603e71b@googlegroups.com> |
| Message-ID | <ANygt.3001$hl7.91@newsfe14.iad> (permalink) |
| Date | 2013-05-02 12:05 -0700 |
On 5/2/13 11:49 AM, mike wrote: > Hi, > > I am using java to send a commdline arg 'mklabel –config hello.o REL3'. > The output that I get is a new line for each element a put the label on. > In my application I want to show the user the progress of the command. > Can I create an event that contains the information for each line and send it to a listener? Or is there a better way? > > > br, > > //mike > > Output from console: > mklabel –config hello.o REL3 > Created label "REL3" on "/usr/hw/" version "/main/1". > Created label "REL3" on "/usr/hw/src" version "/main/2". > Created label "REL3" on "/usr/hw/src/hello.c" version "/main/3". > Created label "REL3" on "/usr/hw/src/hello.h" version "/main/1". > You would start a thread to read the data out of the InputStream (which you need to do anyway to make a Process work as expected). The thread reading the data could send an event anywhere. If you are updating a UI thread, I suggest the following approach: ProgressTrackerThread.run() will read from InputStream, and when newline happens, call "progressUpdated" on a list of Listeners. Create an abstract EventQueueProgressListener implementation. progressUpdated in this impl will be final, and will pass a Runnable to the EventQueue, which then calls a different abstract method (handleProgressUpdated maybe?). That way, you're thread-safe on the EDT for UI updates.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to send console progress information to gui mike <mikaelpetterson@hotmail.com> - 2013-05-02 11:49 -0700
Re: How to send console progress information to gui Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-05-02 12:05 -0700
Re: How to send console progress information to gui mike <mikaelpetterson@hotmail.com> - 2013-05-07 04:50 -0700
Re: How to send console progress information to gui Robert Klemme <shortcutter@googlemail.com> - 2013-05-21 03:22 -0700
Re: How to send console progress information to gui Arne Vajhøj <arne@vajhoej.dk> - 2013-05-18 19:38 -0400
Re: How to send console progress information to gui "John B. Matthews" <nospam@nospam.invalid> - 2013-05-19 00:34 -0400
Re: How to send console progress information to gui Arne Vajhøj <arne@vajhoej.dk> - 2013-06-01 22:09 -0400
csiph-web