[2746] in java-interest
Re: Repainting delayed
daemon@ATHENA.MIT.EDU (Arthur van Hoff)
Thu Oct 12 14:45:29 1995
Date: Thu, 12 Oct 1995 09:36:28 -0700
From: Arthur.Vanhoff@Eng.Sun.COM (Arthur van Hoff)
To: sweh@mpn.com
Cc: java-interest@java.Eng.Sun.COM
Hi Stephen,
> > Try putting a sleep in there so that the event handler has some time
>
> > for (int i = 0 ; i < 10 ; i++) {
> > randomly_select_images;
> > repaint();
> > Thread.sleep(100);
> > }
>
> Unfortunately this doesn't seem to work. I'd tried this with a sleep(1000)
> and all that resulted was a 10 second delay before the screen updated.
I see what the problem is. If you call this code from the AWT thread, it
won't be able to handle the repaints, because you have suspended it in a
sleep. Don't call this from an event handler. Instead, fork a new thread
and call it from there.
> Would it have anything to do with being inside mouseDown() that causes
> the problem (ie are repaint() calls suspended until mouseDown() completes?)
Right. That is the problem.
Have fun,
Arthur van Hoff
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com