public void update(Graphics g) { if (braidWordSet) { Graphics gr; if (offScreenBuffer == null || (!(offScreenBuffer.getWidth(this) == getBounds().width && offScreenBuffer.getHeight(this) == getBounds().height))) { offScreenBuffer = createImage(getBounds().width, getBounds().height); } gr = offScreenBuffer.getGraphics(); braidDrawing.calcXPos( gr, getBounds(), animationStep, parameterAnimationStep2, parameterAnimationStep4, parameterAnimationStep5); braidDrawing.draw(gr); g.drawImage(offScreenBuffer, 0, 0, this); } }