(Confusing)
Normally, the programmer does not paint the screen directly.
One reason is that too many paint calls can get backlogged if the system cannot keep up.
It is better to request that a paint be done and have the system do the best it can to keep up (not every "frame" will necessarily be seen).
Control flow in AWT:
To avoid flicker, either:
a) set the background color to what you want, rather than the default (gray)
or b) redefine update so that it does what you want.
The system default update:
public void update(Graphics g)
{
g.setColor(getBackground());
g.fillRect(0,0,width,height);
g.setColor(getForeground());
paint(g);
}