Just like in the previous example, this applet contains an animation of a circle bouncing around on the screen. However, in this example double buffering is used to get rid of the flickering problem. Double buffering is a technique that draws into an offscreen buffer and then copies the completed work to the display in a single painting operation. Although you can implement the double buffering technique yourself, as shown in a later example, Swing supplies double buffering for free. All you need to do is use a Swing component in a Swing container.
Swing takes care of the details.
Notice that a JPanel Swing component replaces the AWT Panel in BouncingCircle.java. This JPanel component implements double buffering and gets rid of the flickering problem. This applet contains circles bouncing around on the screen. Does not use double buffering so has problems with overlapping circles. Overrides update to avoid flicker problems.