Re: Swing Components Freeze During Other Actions Even With Threads
- From: Hal Vaughan <hal@xxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 19 Jan 2006 03:08:23 -0500
Roedy Green wrote:
> On Thu, 19 Jan 2006 02:13:21 -0500, Hal Vaughan
> <hal@xxxxxxxxxxxxxxxxxxxx> wrote, quoted or indirectly quoted someone
> who said :
>
>>You mean pass a method to it? Then don't I still have to wait on that
>>value? If not, what do I do? Just sleep and the callback will wake the
>>thread?
>
> Why bother with two threads then? Just have the subthread do whatever
> it is needs be done when the information has arrived.
The subthread is supplying the information.
I'm sure there are ways to do this, and maybe someone has pointed it out. I
just don't get it -- seriously. I'm trying to figure out how to do this.
This is on one in a series of panels for setting up a program. The user has
selected a path where the program should be, then clicks "Next". A message
dialogue opens, with a "We're verifying the location" message. Then I run
the program (if it is where it is supposed to be) with a "--version"
argument. I read the output and scan it for the version number. If the
version is acceptable, a new message window opens, saying it will work. If
it is an unacceptable version, a window opens saying it won't work.
On the first dialogue ("We're verifying..."), once I click "Okay", the
message dialogue window goes blank and the entire window goes blank with
it. Nothing happens while the program is being run, printing out the
version, and I'm scanning for the version number. Once that is done, Swing
catches up.
So basically, I need to let the user click "Okay", then, ideally, Swing
would update the window, THEN check the version. But that doesn't happen,
which I know is normal. So I dispatch a thread to check the version
number, but I can't do a thing on the main thread until I know if the
version is acceptable.
So, no matter what I do, I have to wait for the external program to run
before saying it works or won't work. The hard part is I can't get Swing
to update while waiting for the 2nd thread to run the program. I'm still
reading up on what some other responses have said. I know one time I
experimented with invokeLater() and invokeAndWait(), but I've never gotten
them to work properly either.
I have yet to see how I can get Swing to update, then wait for information
in its own thread or a subthread.
Since I am sure this is not the kind of thing the Java team would make this
difficult, I'm sure I'm missing something basic here.
Hal
.
- Follow-Ups:
- Re: Swing Components Freeze During Other Actions Even With Threads
- From: Roedy Green
- Re: Swing Components Freeze During Other Actions Even With Threads
- From: Thomas Weidenfeller
- Re: Swing Components Freeze During Other Actions Even With Threads
- References:
- Swing Components Freeze During Other Actions Even With Threads
- From: Hal Vaughan
- Re: Swing Components Freeze During Other Actions Even With Threads
- From: Roedy Green
- Re: Swing Components Freeze During Other Actions Even With Threads
- From: Hal Vaughan
- Re: Swing Components Freeze During Other Actions Even With Threads
- From: Tony Morris
- Re: Swing Components Freeze During Other Actions Even With Threads
- From: Hal Vaughan
- Re: Swing Components Freeze During Other Actions Even With Threads
- From: Roedy Green
- Swing Components Freeze During Other Actions Even With Threads
- Prev by Date: Re: Swing Components Freeze During Other Actions Even With Threads
- Next by Date: Re: Swing Components Freeze During Other Actions Even With Threads
- Previous by thread: Re: Swing Components Freeze During Other Actions Even With Threads
- Next by thread: Re: Swing Components Freeze During Other Actions Even With Threads
- Index(es):
Relevant Pages
|