Basic HTML version of Foils prepared March 26 1999

Foil 20 Removing Flickering

From Java Academy:Graphical User Interface NPAC Java Academy February--April 99 -- March 1999. by Nancy McCracken

Template for Applet to Draw a Graphics Animation with Control Components
There is another problem for graphics animations caused by continually calling repaint. Recall that repaint calls update, which blanks out the background and then calls paint. Paint then calls various graphics methods to make the new picture.
Unfortunately, there is enough time in-between update and paint, that the user can see flashes of background in-between the two pictures - this is called flickering.
The solution is to change update not to blank the background and to have paint create and draw on a separate image (including the background). The last thing paint does is to transfer that image to the canvas to produce the new picture in as little time as possible.



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Fri Mar 26 1999