update() vs. paint()

Howdy !

Whats the better place to do all the paintingstuff,
in the update(g) or in the paint(g), regarding performance.
As far as i know a repaint calls the update(g), then the update should call paint(g), so is there any reason not to do the painting in the update(g) ?

mbw :-/

Its been awhile since I did this AWT stuff but i believe you will find that Update(0 does a lot of other stuff, including painting the background and handling some of the complex coordination needed for swing.
I woulf not override update but instead override paint.
YMMV.

If the base window is derived from Swing classes, maybe even better override paintComponent()?

Jeff, do you mean that for using Swing-Components or, too, for painting game-content without any of the awt-Components (like Panel etc.) included ?

If you’re using older style AWT type graphics, then override update to avoid flickering.

If you are using Swing classes, then don’t touch update ( I think it’s not even called anymore) and override either paint() or paintComponent().

paintComponent() is good to override because then component borders will be painted properly.

What is the better way ? Using Swing-classes or using awt ?

That depends on your usage, but usually Swing is preferred. It is certainly a more modern API.