Animated GIFs in JGoImage


#1

I’m currently loading an animated GIF into a JGoImage which is contained in a JGoArea.
The problem is that the animation isn’t taking place - it only seems to update if I click on and off the JGoArea.
Are animated GIFs a no-no with JGoImages then?


#2

Try overriding the JGoImage.imageUpdate method:
public boolean imageUpdate(Image img, int infoflags,
int x, int y, int width, int height) {
if ((infoflags & ALLBITS) != 0) {
update(); // just repaint this object
return false;
} else if ((infoflags & FRAMEBITS) != 0) {
try {
Thread.sleep(10);
} catch (InterruptedException ex) {
update();
return false;
}
update();
return true;
} else {
return true;
}
}
You may want to adjust the sleep period.