How Double Buffering Works

If the next frame of an animation is updated onscreen, you have single buffering—all the painting is done in a single buffer—not to mention potential flicker between frames. If the next frame is updated in an offscreen buffer and subsequently copied to the screen, you have double buffering and no flicker because the erasing takes place offscreen.

Flicker is a symptom of erasing part or all of the previous frame onscreen when rendering the next frame in an animation; the erasing can be impossible to avoid with animations of any complexity. Double buffering eliminates the flicker by preparing the next frame in an offscreen buffer, and then copying—or blitting—the completed frame to the screen, avoiding the onscreen erasing ...

Get Graphic Java™ 1.2, Volume I: AWT, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.