protected void paintDoubleBuffered(JComponent c,Image image,Graphics g,int clipX,int clipY,int clipW,int clipH){
  Graphics osg=image.getGraphics();
  int bw=Math.min(clipW,image.getWidth(null));
  int bh=Math.min(clipH,image.getHeight(null));
  int x, y, maxx, maxy;
  try {
    for (x=clipX, maxx=clipX + clipW; x < maxx; x+=bw) {
      for (y=clipY, maxy=clipY + clipH; y < maxy; y+=bh) {
        osg.translate(-x,-y);
        osg.setClip(x,y,bw,bh);
        if (volatileBufferType != Transparency.OPAQUE && osg instanceof Graphics2D) {
          final Graphics2D g2d=(Graphics2D)osg;
          final Color oldBg=g2d.getBackground();
          g2d.setBackground(c.getBackground());
          g2d.clearRect(x,y,bw,bh);
          g2d.setBackground(oldBg);
        }
        c.paintToOffscreen(osg,x,y,bw,bh,maxx,maxy);
        g.setClip(x,y,bw,bh);
        if (volatileBufferType != Transparency.OPAQUE && g instanceof Graphics2D) {
          final Graphics2D g2d=(Graphics2D)g;
          final Composite oldComposite=g2d.getComposite();
          g2d.setComposite(AlphaComposite.Src);
          g2d.drawImage(image,x,y,c);
          g2d.setComposite(oldComposite);
        }
 else {
          g.drawImage(image,x,y,c);
        }
        osg.translate(x,y);
      }
    }
  }
  finally {
    osg.dispose();
  }
}

protected void paintDoubleBuffered ( JComponent c , Image image , Graphics g , int clipX , int clipY , int clipW , int clipH ) { Graphics osg = image . getGraphics ( ) ; int bw = Math . min ( clipW , image . getWidth ( null ) ) ; int bh = Math . min ( clipH , image . getHeight ( null ) ) ; int x , y , maxx , maxy ; try { for ( x = clipX , maxx = clipX + clipW ; x < maxx ; x += bw ) { for ( y = clipY , maxy = clipY + clipH ; y < maxy ; y += bh ) { osg . translate ( - x , - y ) ; osg . setClip ( x , y , bw , bh ) ; if ( volatileBufferType != Transparency . OPAQUE && osg instanceof Graphics2D ) { final Graphics2D g2d = ( Graphics2D ) osg ; final Color oldBg = g2d . getBackground ( ) ; g2d . setBackground ( c . getBackground ( ) ) ; g2d . clearRect ( x , y , bw , bh ) ; g2d . setBackground ( oldBg ) ; } c . paintToOffscreen ( osg , x , y , bw , bh , maxx , maxy ) ; g . setClip ( x , y , bw , bh ) ; if ( volatileBufferType != Transparency . OPAQUE && g instanceof Graphics2D ) { final Graphics2D g2d = ( Graphics2D ) g ; final Composite oldComposite = g2d . getComposite ( ) ; g2d . setComposite ( AlphaComposite . Src ) ; g2d . drawImage ( image , x , y , c ) ; g2d . setComposite ( oldComposite ) ; } else { g . drawImage ( image , x , y , c ) ; } osg . translate ( x , y ) ; } } } finally { osg . dispose ( ) ; } }
paints a portion of a component to an offscreen buffer .
