954,545 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Dealing with animation and components? (isolating the two while drawing)

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.

Mr.UNOwen
Junior Poster
133 posts since Oct 2006
Reputation Points: 10
Solved Threads: 0
 
quuba
Posting Pro
573 posts since Nov 2008
Reputation Points: 123
Solved Threads: 106
 

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()?

Mr.UNOwen
Junior Poster
133 posts since Oct 2006
Reputation Points: 10
Solved Threads: 0
 

> 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.

Ezzaral
Posting Genius
Moderator
15,986 posts since May 2007
Reputation Points: 3,250
Solved Threads: 847
 

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?

Mr.UNOwen
Junior Poster
133 posts since Oct 2006
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You