简体   繁体   中英

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?

Abstract Window Toolkit有一个支持GIF的getImage()方法。

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM