On Thu, 29 Sep 2005 20:49:04 GMT, zero <zero@this.hi> wrote or quoted
> myButton.setEnabled(false);
> doTask();
> myButton.setEnabled(true);
He talked of impatient users, so I don't think it wise to do this on
the Swing thread.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
zero - 30 Sep 2005 13:52 GMT
> On Thu, 29 Sep 2005 20:49:04 GMT, zero <zero@this.hi> wrote or quoted
>
[quoted text clipped - 4 lines]
> He talked of impatient users, so I don't think it wise to do this on
> the Swing thread.
True, a hanging gui is annoying.
supermail99@fastmail.fm - 11 Oct 2005 15:10 GMT
> myButton.setEnabled(false);
> doTask();
> myButton.setEnabled(true);
Simply doing this does not work. I don't understand why. Java still
alllows me to press the button while doTask is executing. Please
explain this.
iamfractal@hotmail.com - 11 Oct 2005 16:03 GMT
supermail99@fastmail.fm skrev:
> > myButton.setEnabled(false);
> > doTask();
[quoted text clipped - 3 lines]
> alllows me to press the button while doTask is executing. Please
> explain this.
Please supply ballsack.
.ed
--
www.EdmundKirwan.com - Home of The Fractal Class Composition.
Roedy Green - 13 Oct 2005 05:38 GMT
On 11 Oct 2005 07:10:10 -0700, supermail99@fastmail.fm wrote or quoted
>> myButton.setEnabled(false);
>> doTask();
[quoted text clipped - 3 lines]
>alllows me to press the button while doTask is executing. Please
>explain this.
that is because you tied up the event thread
with doTask so Swing could not do any painting.
See http://mindprod.com/jgloss/swingthreads.html
and look for SwingWorker. You can us ethat to spin off doTask on
another thread allowing the GUI to paint the setEnabled(false), done
when the repaint event pops to the top of the queue not here.
The last thing doTask should do (or its caller should do) is call
SwingUtilities.invokeLater the setEnabled(true). that has to go on the
Swing thread not the doTask thread.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.