Animated GIF in Splashscreen

2019-09-05 06:37发布

问题:

I have a JAR file generated by an ANT script with the following code in it:

<manifest>
   <attribute name="Main-Class" value="org.epistasis.exstracs.Main"/>
   <attribute name="Class-Path" value="."/>
   <attribute name="SplashScreen-Image" value="logo_anim.gif"/>
</manifest>
<!--Some code-->
<zipfileset dir="." includes="logo.png"/>
<zipfileset dir="." includes="logo_anim.gif"/>
<zipfileset dir="." includes="icon.png"/>

When I run the JAR file, no splash screen is generated. I verified that the GIF was in the file by opening it with my favorite archive manager. I also loaded the GIF from the code and successfully displayed it. However, it won't load as a splashscreen. (no splashscreen displayed, SplashScreen.getSplashScreen() returns null)

If I replace

<attribute name="SplashScreen-Image" value="logo_anim.gif"/>

With

<attribute name="SplashScreen-Image" value="logo.png"/>

OR

<attribute name="SplashScreen-Image" value="icon.png"/>

The splashscreen is displayed with the specified image.

I'm not sure if this matters, but the GIF is significantly larger than the PNG files. (~2MB for logo_anim.gif vs 40KB for logo.png)