Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #24144
| X-Received | by 10.224.217.195 with SMTP id hn3mr1190751qab.5.1369131747346; Tue, 21 May 2013 03:22:27 -0700 (PDT) |
|---|---|
| X-Received | by 10.50.112.105 with SMTP id ip9mr139874igb.1.1369131747304; Tue, 21 May 2013 03:22:27 -0700 (PDT) |
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!l3no10743597qak.0!news-out.google.com!y6ni50669qax.0!nntp.google.com!ch1no132915qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
| Newsgroups | comp.lang.java.programmer |
| Date | Tue, 21 May 2013 03:22:27 -0700 (PDT) |
| In-Reply-To | <ANygt.3001$hl7.91@newsfe14.iad> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=80.66.20.180; posting-account=MGO7qgoAAABvyo26eHVDO00044spH-ws |
| NNTP-Posting-Host | 80.66.20.180 |
| References | <6aaa6aa4-440f-44fc-8efe-a06f6603e71b@googlegroups.com> <ANygt.3001$hl7.91@newsfe14.iad> |
| User-Agent | G2/1.0 |
| MIME-Version | 1.0 |
| Message-ID | <af1c0623-3530-4b7f-bc0a-e0169e4843cb@googlegroups.com> (permalink) |
| Subject | Re: How to send console progress information to gui |
| From | Robert Klemme <shortcutter@googlemail.com> |
| Injection-Date | Tue, 21 May 2013 10:22:27 +0000 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Xref | csiph.com comp.lang.java.programmer:24144 |
Show key headers only | View raw
On Thursday, May 2, 2013 9:05:08 PM UTC+2, Daniel Pitts wrote: > 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. There is SwingWorker for such things. http://docs.oracle.com/javase/6/docs/api/javax/swing/SwingWorker.html You still need an additional thread since there are two streams to read from (alternatively use a Selector from NIO). Kind regards robert
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