The previous statements could be in init() while in paint(), one will construct applet image in offscreenGraphics as opposed to the argument g of paint(). So one would see statements such as: |
e.g. offscreenGraphics.drawImage(img,10,10,this); |
Finally at end of paint(), one could transfer the double buffered image to g by |
g.drawImage(offscreenImage,0,0,this); |
One would also need to override the update() method by |
public void update(Graphics g) { |
paint(g); |
} |