Re: SwingWorker.execute() does nothing
- From: Ben Phillips <b.phillips@xxxxxxxxxxxxxxxxx>
- Date: Wed, 08 Oct 2008 23:37:07 -0400
John W Kennedy wrote:
Ben Phillips wrote:Nigel Wade wrote:Ben Phillips wrote:
Thomas Kellerer wrote:Ben Phillips, 08.10.2008 08:45:Really? What idiot made that boneheaded design decision --I've got a strange app hang. A particular button click pops up a modal "Please Wait" dialog, then constructs a SwingWorker implementation and calls execute() on it. The done() method removes the dialog.When you call setVisible(true) on a modal dialog, your code will stop until the dialog is closed. So if you call SwingWorker.execute() after setVisible(true) the execute() will not be called until the dialog is closed.
What do you mean, boneheaded? It's what modal Dialogs do.
It's not the behavior implied by the Swing tutorial, which says that there is exactly one event dispatch thread.
Which is exactly why your mainline code stopped dead at the setVisible(true). That's what "modal dialog" /means/; the dialog is alive, while the code that displayed it is frozen
No, "modal dialog" means that the main window will not receive UI events while it is displayed.
The behavior you are describing is neither obvious from perusing the Swing tutorial nor obvious from the industry-wide definition of "modal dialog".
The execute(), therefore, was never even reached
But this was not obvious on casual inspection. The user's first encounter with this is going to look like "execute() didn't do anything". Indeed, did look like that.
Please stop posting to this thread now. The problem has been solved and continuing to post here can therefore serve no useful purpose related to the solving of that problem.
.
- Follow-Ups:
- Re: SwingWorker.execute() does nothing
- From: Owen Jacobson
- Re: SwingWorker.execute() does nothing
- From: Lew
- Re: SwingWorker.execute() does nothing
- References:
- SwingWorker.execute() does nothing
- From: Ben Phillips
- Re: SwingWorker.execute() does nothing
- From: Thomas Kellerer
- Re: SwingWorker.execute() does nothing
- From: Ben Phillips
- Re: SwingWorker.execute() does nothing
- From: Nigel Wade
- Re: SwingWorker.execute() does nothing
- From: Ben Phillips
- Re: SwingWorker.execute() does nothing
- From: John W Kennedy
- SwingWorker.execute() does nothing
- Prev by Date: Re: Fast-Fourier transform
- Next by Date: Re: SwingWorker.execute() does nothing
- Previous by thread: Re: SwingWorker.execute() does nothing
- Next by thread: Re: SwingWorker.execute() does nothing
- Index(es):