Double Buffer Applet Graphics
CMPC :: Computing :: Programming :: Java
Page 1 of 1
Double Buffer Applet Graphics
All you need to do this is to overload the update function of the Applet class
- Code:
private Image dbImage;
private Graphics dbg;
public void update(Graphics g)
{
if(dbImage == null)
{
dbImage = createImage(width, height);
dbg = dbImage.getGraphics();
}
dbg.setColor(getBackground());
dbg.fillRect(0,0, width, height);
dbg.setColor(getForeground());
paint(dbg);
g.drawImage(dbImage,0,0,this);
}
Paul- Pickaxe
- Posts : 611
CMPC :: Computing :: Programming :: Java
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|