Cleaning up flicker...
In previous programs created by myself, I have used a double buffering method to prevent flicker from being created when the screen is cleared for the next frame. However, this does not stop the flicker created when two drawn pieces of the program overlap.
My graphical code looks like this:
publicvoid update (Graphics g){
paint(g);
if (dbImage ==null){
dbImage = createImage(this.getSize().width, this.getSize().height);
dbg = dbImage.getGraphics();
}
dbg.setColor(getBackground());
dbg.fillRect(0, 0, this.getSize().width, this.getSize().height);
dbg.setColor(getForeground());
paint(dbg);
g.drawImage(dbImage, 0, 0,this);
}
publicvoid paint (Graphics g){
g.setColor(Color.red);
g.fillRect(100, 100, 100, 100);
g.setColor(Color.blue);
g.fillRect(150, 150, 100, 100);
}
Where update is called by a repaint() method inside a run() method loop. Any help or advice that could be offered is much appreciated, just trying to step my code up to the next level.

