04-27-2012 04:22 PM
Hey guys, I've got the gif up and running using this article: http://supportforums.blackberry.com/t5/Java-Develo
After a lot of searching though, I can't really seem to find out how to manipulate the gif. I know how to position it, but how can I make it only run through once and disappear after its done the cycle? Any links or guides to this area would be very helpful, I want to heavily use GIFs in the future. Thanks!
04-27-2012 04:58 PM
You can do all kinds of checks in paint and schedule some action via invokeLater when you reach frame #0 for the second time. For example, you might stop the animation thread, set some "do not paint" flag and ask for a layout via updateLayout. In your layout, check that "do not paint" flag and set extent to (0, 0) if true.
You'll need two boolean flags for this:
- firstTime, initially true and reset to false after the first check in paint. If already false and frame index is 0, stop animation;
- doNotPaint, initially false and checked both in layout and paint. If true, set extent to (0, 0) in layout and return immediately in paint.
I'm sure there must be other ways to achieve something similar - this is just me brainstorming the issue...