import java.awt.*;

public class AnotherCanvas extends Canvas{
	private Image dbImage;
	private Graphics dbGraphics;

	
	public void update(Graphics g){
		//Double-Buffer initialisieren
		if(dbImage == null||this.getSize().height!=dbImage.getHeight(this)||this.getSize().width!=dbImage.getWidth(this)){
			dbImage = createImage(this.getSize().width, this.getSize().height);
			dbGraphics = dbImage.getGraphics();
		}
		//Hintergrund loeschen
		dbGraphics.setColor(getBackground());
		dbGraphics.fillRect(0,0,this.getSize().width, this.getSize().height);
		//Vordergrund zeichene
		dbGraphics.setColor(getForeground());
		paint(dbGraphics);
		//Offscreen anzeigen
		g.drawImage(dbImage,0,0,this);
	}




}