Summary

Double buffering is an essential technique for dragging lightweight components and for implementing flicker-free animations. Double buffering is implemented by drawing the next frame in an animation into an offscreen buffer; once the offscreen buffer represents the next frame in the animation, it is copied to the screen. This chapter has presented a handful of reusable classes that you can use for implementing double buffering.

In the next chapter, we will build on the DoubleBufferedContainer class presented in this chapter by implementing a Playfield class that can contain animated sprites.

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.