Skip to main content

animation problem

2 replies [Last post]
Joined: 2008-07-03

hello guys! seik is here with new questions for you!(again...T_T)
I'm making an app to show videos. If it was only to play and stop it would be great but NOOOO, we need to make it more complete.....(for boss hapiness and my despair lol)
So after a lot of study and pratice (....2 days is alot to me) I finally was able to make the bar that shows the progress of the video ^^.....with a small only updates itself when I change focus on the form....T_T

Finally, after lots of useless talk, HERE IS THE QUESTION:
How can I animate a component "all the time" instand of "only when I change focus"
I mean: I want it(the bar) to repaint always (it could be every 1 sec or so), without the need for the user(who would be watching the video) to press a button(to change focus/update the bar)

The Bar:
-It extends Component
-Its constructor creates a Thread that repeats itself while the component isVisible(), inside it, sets a DirtyRegion on my BarComponent and calls repaint <-not sure if its the best option.....
-Has an overwriten method paint(), where I draw it(the bar);

If you didn't understand something, please ask, if you did understand and knows the answer.....please please please answer ^^
cya later

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2009-01-19

Look into Animation

Here's a possible solution:

Ther form has registerAnimated() and deregisterAnimated() you can call
in the form's initComponent() and deinitialize()

If your Bar implements Animation, then you can register it.

Next have a thread set a percentage field in the bar (percentage you want painted)

The bar's paint() method uses the percentage field to fill a rectangle.

Hope that makes sense.

Joined: 2008-07-03

I implemented the animation on my component and registered it in the form as animated, but it wasn't working properly....then I overwrited the method animate() to return true, and fixed the problem ^^
Thanks for the help ^^