Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loading animated GIF's one after the other 1

Status
Not open for further replies.

Acquiesce

Programmer
Dec 11, 2001
13
GB
i'm writing an application in which i want icons that trigger events when clicked.

for each event i wish to load 2 animated GIF's BUT i need to wait for one to finish animating before the next starts.

i know the length of time each GIF animates.

is there any way to do this without creating additional threads? is it possible to simply call sleep() from the main thread?

many thanks
Waylon
 

There is a simple way. when you a call the drawImage() funtion it returns a boolean .

For an animated gif the paint() gets called (from an internal AWT Thread )for each frame for the purpose of animation and when the last frame gets painted this method returns true.

So draw the first image wait for the drawImage to return true.

After that draw Your Second Image.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top