Home : Course Map : Chapter 11 : Java : Supplements :
Reducing Flicker in
AWT Component Drawing
JavaTech
Course Map
Chapter 11

Introduction
Image Class
Image Loading
  Demo 1 Demo 2  
Pixels/Transparency
  Demo 3
Pixel Handling
  Demo 4  
Demo 5
Exercises

    Supplements
Java 2D Imaging
BufferedImage
Creating Buf.Image
Pixel Handling
  Demo 1 Demo 2
Filters
  Convolutions
     Demo 3
  AffineTransforms
     Demo 4
  LookupTable
     Demo 5 Demo 6
  Rescale
     Demo 7
  Color Conversion
     Demo 8
  Custom
     Demo 9
Exercises
Java Adv Imaging
AWT Flicker:
  Override Update
     Demo 1  Demo 2
  Clipping
     Demo 3
  Double Buffer
     Demo 4

     About JavaTech
     Codes List
     Exercises
     Feedback
     References
     Resources
     Tips
     Topic Index
     Course Guide
     What's New

Fast re-drawing of images and patterns on an AWT panel, such as in an animation, typically results in flashing or flickering effect if no special techniques are employed. Drawing involved a large number of graphics operations and flickers result when the drawing cannot keep up with the number of redraws requested. The degree of the flickering depends on the speed of the machines but is usually present even on the fastest platforms.

The flicker can be drastically reduced or eliminated by reducing the number of drawing operations. The most simple approach to drawing uses many redundant operations that can be eliminated with the techniques discussed here:

  • Override Update - the update() method clears the drawing area by drawing a rectangle with the background color. If the whole area is going to be redrawn anyway in the paint() method, then its best to override update() and not do the clear.

  • Clipping - only redraw the areas that have changed from one frame to the next.

  • Double Buffer - save time by first doing all the drawing to an off screen buffer and then sending this to the screen in one big transfer rather than in many small transfers for each drawing operation.

 

References & Web Resources

Latest update: Dec.3, 2004

              Tech
Fractals
Fractal Drawing
   Demo 1
Fractal Draw Code
Fractal Images
  Demo 2
Image Processing
  Demo 3
Histogram Image
  Demo 4
Exercises

           Physics
Calibration/SysError
SimWithCal/SysErr
  Demo 1
Analysis
  Demo 2
Examples

Exercises

  Part I Part II Part III
Java Core 1  2  3  4  5  6  7  8  9  10  11  12 13 14 15 16 17
18 19 20
21
22 23 24
Supplements

1  2  3  4  5  6  7  8  9  10  11  12

Tech 1  2  3  4  5  6  7  8  9  10  11  12
Physics 1  2  3  4  5  6  7  8  9  10  11  12

Java is a trademark of Sun Microsystems, Inc.