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


Groups > comp.lang.java.gui > #3661 > unrolled thread

Re: How to refresh UI imm

Started by"Lew" <lew@THRWHITE.remove-dii-this>
First post2011-04-27 15:46 +0000
Last post2011-04-27 15:46 +0000
Articles 1 — 1 participant

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.


Contents

  Re: How to refresh UI imm "Lew" <lew@THRWHITE.remove-dii-this> - 2011-04-27 15:46 +0000

#3661 — Re: How to refresh UI imm

From"Lew" <lew@THRWHITE.remove-dii-this>
Date2011-04-27 15:46 +0000
SubjectRe: How to refresh UI imm
Message-ID<UfednbRduvuTHMXVnZ2dnUVZ_sydnZ2d@comcast.com>
  To: comp.lang.java.gui
mrstephengross wrote:
> I have a combobox with an ActionListener. When you select an item, it
> fires off a process that can take a few seconds to execute. I have
> found that when you click your selection, it fires the process but
> does not immediately close the combo box. That is, it waits until the
> process is done running before closing the combobox.
> 
> Is there a way to change this behavior? I would like to close the
> combobox immediately after an item in it is selected and then fire off
> the process.

What you have experienced is the Dark Side of the Event Dispatch Thread (EDT). 
  The GUI all runs in its own thread, the EDT. You also apparently ran the 
process on the same thread.  (Guessing, since you declined to provide an 
SSCCE.)  What you need is something like the SwingWorker class to move the 
hard work off to an independent thread, then the GUI can get right back to its 
refresh immediately.

See the Sun Swing tutorial for details.

-- 
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] | [standalone]


Back to top | Article view | comp.lang.java.gui


csiph-web