views:

81

answers:

1

I'm trying to write a silly little app using Java and AWT.

It simply runs and animates some shapes, so as a first step, I created a simple app that clears a canvas with fillRect every 50ms.

The problem is, my app flickers every now and then with the underlying window colour. Google is failing me when it comes to finding simple hello-world type examples of flicker-free animating AWT apps.

What would the skeletal code for something like this look like?

+3  A: 

Have a look for double buffering code.

http://www.codeproject.com/KB/graphics/javadoublebuffer.aspx

Paul Whelan