Chris
Chris

Reputation: 85

Adding a gif Image to a java applet?

I'm trying to add a .gif image into my java applet but for some reason it just turns blank.. I'm using getImage(getCodeBase(), "BLACK_Sel.gif ") to get my .gif image, it worked fine with .jpg images but not a .gif image.. then to paint the .jpg/.gif I use

g.drawImage(SelectedBlack,testx, testy, Checkers.SIZE_Y / 8, Checkers.SIZE_Y / 8, null);

which, again, works fine for .jpgs. is there a different way I have to do this for an animated .gif image?

Upvotes: 2

Views: 2578

Answers (1)

The Abstract Window Toolkit has a getImage() method that supports GIF.

Image img1 = Toolkit.getDefaultToolkit().getImage("yourFile.gif");

Upvotes: 4

Related Questions