So I know how to do animation and I know to deal with components, but I don't know how to do both. How can I isolate the drawing of the components from the animation? The particular problem I'm having is when I have an opaque component over the animation?

I was thinking of having overlapping panels within a main panel. the two inner panels would have an image to draw to. Every time one of the two draws, the main panel draws both by drawing the two images that are acting as a buffer. The problem I'm having is how to deal with event handling.

Does anyone know how to do animation with components??? I can't figure out a decent solution.......

Isn't it generally a bad idea to keep calling repaint()?

> Isn't it generally a bad idea to keep calling repaint()?
No, that is generally what animation loops do: update component states and call repaint() to refresh them on the screen. If by "keep calling" you mean without any pause, then no, you usually want to sleep for some period of time so that other processes are getting a fair chance to run as well.

Doesn't event handling get blocked out when repaint is called? So if I press a button it might not detect because it's in the middle of a paint method?

Also what's the best way to do animation, create a new thread and loop or use timer?