🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #1287

GUI Responsiveness Problem

#1287
From: Steve
Date: Thu, 25 Dec 2003 00:33
25 lines
2354 bytes
Imagine a GUI control that starts a long-running process from its action
event. Since the event handler executes on the event-handling thread, the
GUI is frozen while the process completes. Often this is exactly what we
want (e.g., refreshing a query; there's nothing for the user to do until the
refresh is complete). JButton handles this nicely by depressing and changing
the cursor _before_ the action event handler is called so that the user
knows the application isn't frozen. But JComboBox leaves its picklist
extended and appears frozen to the user until the event handler exits.

What I'd like to be able to do is for the JComboBox to get ahold of itself,
but still block on the event-handling thread after that. Any ideas?

I came up with a really hideous hack that I'm not happy with: In the action
event handler, create a SwingWorker with an empty construct() method and the
long-running process called from the finished() method (forcing it on to the
event-dispatching thread). The start() method is called just before the
event handler exits. This gives the GUI enough time to retract the picklist.
However this is a kludge because it's timing dependent. It also doesn't work
if you put any other GUI code in the event handler (e.g., setting the wait
cursor) unless you add a delay timer to the construct method. There's gotta
be an easier way to do something so basic.

Any ideas greatly appreciated. Thx.

-Steve
Technical Details
Message-ID: <3fea3050$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!news-out.visi.com!petbe.visi.com!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,f4eeb7806688d1cc,start
X-Google-Attributes: gid111d45,public
X-Google-ArrivalTime: 2003-12-24 16:39:09 PST
From: "Steve" <pearsons_11113@mindspring.com>
Newsgroups: borland.public.jbuilder.java.swing
Subject: GUI Responsiveness Problem
Date: Wed, 24 Dec 2003 16:33:20 -0800
Lines: 27
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 199.174.199.173
Message-ID: <3fea3050$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1072312400 199.174.199.173 (24 Dec 2003 16:33:20 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!news-out.visi.com!petbe.visi.com!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail