1 | 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. |
2 | 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. |
3 | 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. |