Re: Swing event priority



On 4/3/2005 at 10:15:48 PM, Hegemony Cricket wrote:

> My application has a JTabbedPane. On one of its panels there's a button,
> that does a slow operation. Surprisingly to me, if I click the button
> multiple times, then click one of the other tabs on the JTabbedPane, the
> pane-switching event is occurring before all the button clicks get
> handled.

Are you performing the slow operation in the Event Dispatch Thread? I
presume you must be, since if you were spawning a background thread, then
the behavior you describe would be the obvious, expected behavior. If so,
then that is definitely not a good idea. Consider running the operation
in a separate thread. You will probably want to disable the action while
it is running.

--
Regards,

John McGrath
.