CMPC
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Double Buffer Applet Graphics

Go down

Double Buffer Applet Graphics Empty Double Buffer Applet Graphics

Post by Paul Mon Dec 07, 2009 7:34 am

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
Paul
Pickaxe

Posts : 611

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum