public void prePaint() { BufferStrategy bf = f.getBufferStrategy(); Graphics g = null; try { g = bf.getDrawGraphics(); // It is assumed that mySprite is created somewhere else. // This is just an example for passing off the Graphics object. this.paintAll(g); } finally { // It is best to dispose() a Graphics object when done with it. g.dispose(); } // Shows the contents of the backbuffer on the screen. bf.show(); }