Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #3786

Re: Keeping GUI responsiv

From "Lew" <lew@THRWHITE.remove-dii-this>
Subject Re: Keeping GUI responsiv
Message-ID <cLydnXdDLaASYOLVnZ2dnUVZ_q2dnZ2d@comcast.com> (permalink)
Newsgroups comp.lang.java.gui
References <487f787a$0$4067$b9f67a60@news.newsdemon.com>
Date 2011-04-27 15:46 +0000
Organization TDS.net

Show all headers | View raw


  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

Back to comp.lang.java.gui | Previous | NextNext in thread | Find similar | Unroll thread


Thread

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

csiph-web