code: public void update(final Graphics g) {
          final Dimension d = getSize();
          if ( (this.offScreenImage == null) ) {
              this.offScreenImage = createImage( d.width,
                                            d.height );
          }
          paint( this.offScreenImage.getGraphics() );
          g.drawImage( this.offScreenImage,
                       0,
                       0,
                       null );
      }
docs: Use double buffering.
  
  @see java.awt.Component#update(java.awt.Graphics)