Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #3786 > unrolled thread
| Started by | "Lew" <lew@THRWHITE.remove-dii-this> |
|---|---|
| First post | 2011-04-27 15:46 +0000 |
| Last post | 2011-04-27 15:46 +0000 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.java.gui
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Keeping GUI responsiv "Lew" <lew@THRWHITE.remove-dii-this> - 2011-04-27 15:46 +0000
Re: Keeping GUI responsiv "John B. Matthews" <john.b..matthews@THRWHITE.remove-dii-this> - 2011-04-27 15:46 +0000
| From | "Lew" <lew@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:46 +0000 |
| Subject | Re: Keeping GUI responsiv |
| Message-ID | <cLydnXdDLaASYOLVnZ2dnUVZ_q2dnZ2d@comcast.com> |
To: comp.lang.java.gui Alex wrote: >> I do some lengthy calculations in the event handling thread and >> therefore my GUI is not responsive. >> I know I could run the calculations in a worker thread, but I wonder >> if there is not a simpler way. >> >> In C++ with the Qt class library there is a 'processEvents()' methods >> that can be called from the event handling thread to process pending >> (GUI) events. Is there something equivalent in Java or do I absolutely >> need a worker thread? Knute Johnson wrote: > Yes. <http://java.sun.com/javase/6/docs/api/javax/swing/SwingWorker.html> Read the Swing tutorial. It covers the need to do all GUI work, even construction, on the Event Dispatch Thread (EDT), the GUI thread. Don't try to wiggle out of this. It is a curiosity to me that some people look for a "way out" of having to put work not on the EDT and GUI only on the EDT. That's the way it works. Just do it right, and things work. What's there to get "out" of? How is it not simple enough the way it is? Just learn the right way. -- Lew --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [next] | [standalone]
| From | "John B. Matthews" <john.b..matthews@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:46 +0000 |
| Message-ID | <nospam-CFB607.11155918072008@aioe.org> |
| In reply to | #3786 |
To: comp.lang.java.gui In article <cLydnXdDLaASYOLVnZ2dnUVZ_q2dnZ2d@comcast.com>, Lew <com.lewscanon@lew> wrote: > Alex wrote: > >> I do some lengthy calculations in the event handling thread and > >> therefore my GUI is not responsive. > >> I know I could run the calculations in a worker thread, but I wonder > >> if there is not a simpler way. > >> > >> In C++ with the Qt class library there is a 'processEvents()' methods > >> that can be called from the event handling thread to process pending > >> (GUI) events. Is there something equivalent in Java or do I absolutely > >> need a worker thread? > > Knute Johnson wrote: > > Yes. > > <http://java.sun.com/javase/6/docs/api/javax/swing/SwingWorker.html> > > Read the Swing tutorial. It covers the need to do all GUI work, even > construction, on the Event Dispatch Thread (EDT), the GUI thread. > > Don't try to wiggle out of this. It is a curiosity to me that some people > look for a "way out" of having to put work not on the EDT and GUI only on the > EDT. That's the way it works. Just do it right, and things work. What's > there to get "out" of? How is it not simple enough the way it is? > > Just learn the right way. OP: Having travelled this road recently, it's clear that you wind up doing _more_ work if you try to avoid SwingWorker: EDT, synchronization, etc. Here's a back port if you're stuck on a pre-1.6 system: <https://swingworker.dev.java.net/> -- John B. Matthews trashgod at gmail dot com home dot woh dot rr dot com slash jbmatthews --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.gui
csiph-web