if ( offScreenImage == null ) {
offScreenImage = createImage( getSize().width, getSize().height );
offScreenGC = offScreenImage.getGraphics();
}
int lastX = currentX, lastY = currentY;
currentX = nextX; currentY = nextY;
clipToAffectedArea( offScreenGC, lastX, lastY, currentX, currentY, imgWidth, imgHeight );
clipToAffectedArea( g, lastX, lastY, currentX, currentY, imgWidth, imgHeight );
paint( offScreenGC );
g.drawImage(offScreenImage, 0, 0, this);