Every call to repaint runs update(), which clears the background using gray.
After this every ball is painted directly onscreen, which results in some balls blinking.
The net effect is that the entire applet blinks grey once in a while and some of the balls
blink every so often.
source (DK comments)
|
The update() method is overridden so it calls paint() in stead of clearing the Applet's surface using the background color.
Paint() still writes directly to the screen, so single balls still flicker.
source (DK comments)
|
The update() method is overriden to call paint()
and the paint() method writes to an off screen image, and this image is copied to the screen in the end of the paint() method.
source (DK comments)
|