Re: Swing Components Freeze During Other Actions Even With Threads



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
.



Relevant Pages

  • Re: Open link in New Window problem
    ... New Window is Blank ... Ramesh - Microsoft MVP ... An IE window opens, but the web page ... way through saying 'this product is not Microsoft ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: New applet project
    ... A web start application (or applet) ... object moving in a window; I have also some text attached to this work ... Note that (java.awt.)Canvas is part of the AWT, ... looking to Swing for good GUI's. ...
    (comp.lang.java.help)
  • Re: Here we go...
    ... > S> had an argument with my husband about it, him saying I did, me saying ... I also read a couple of books while in the hospital and I'd bet I ... Concord River and some woods out my window... ...
    (rec.arts.bodyart)
  • Re: Orb and WMP10
    ... Seems a more thorough search in the KB revealed that some ASX mishandling ... > 1) If I click on PLAY, ... > window opens briefly and closes. ... >>> a window opens up briefly and then closes, too quick for me to see what ...
    (microsoft.public.windowsmedia.player)
  • RE: Only allowed one browser window at a time
    ... I've never seen a popup blocker prevent you from ... crap ended up on my machine when I didn't install it. ... > only have one browser window open at a time. ... > browser, the new window opens then ...
    (microsoft.public.windows.inetexplorer.ie6.browser)