do you mean the setCacheImage(0) before the repaint?