A default loading screen is displayed when an applet is being loaded in the web page. You can display a customized splash screen by specifying the following parameters when you deploy the applet:
image
- the image to be displayed in the splash screenboxbgcolor
- the background color of the area in which the applet will be displayedboxborder
- whether the applet should have a border; defaults to true
centerimage
- the position of the image; defaults to false
The splash screen can display a static image or an animated gif.
The code snippet from
shows how to customize the splash screen to display an animation of the Duke, the Java mascot.AppletPage.html
<script src="http://www.java.com/js/deployJava.js"></script> <script> var attributes = {code:'SwingSet2Applet.class', archive:'SwingSet2.jar', width:695, height:525} ; <!-- customize splash screen display options --> var parameters = {jnlp_href: 'SwingSet2.jnlp', image: 'dukeanimated.gif', boxbgcolor: 'cyan', boxborder: 'true', centerimage: 'true' } ; deployJava.runApplet(attributes, parameters, '1.6'); </script>
Open
in a browser to view the splash screen when the SwingSet2 Demo applet is loaded. If you've clicked this link before and viewed the SwingSet2 Demo applet, make sure to clear your cache using the Java Control Panel. You may not see the splash screen if the applet loads quickly.AppletPage.html
If you don't see the applet running, you need to install at least the Java SE Development Kit (JDK) 6 update 10 release.
If you don't see the example running, you might need to enable the JavaScript interpreter in your browser so that the Deployment Toolkit script can function properly.
See the Displaying a Customized Loading Progress Indicator topic for information about displaying a customized loading progress indicator when the applet's resources are being downloaded.
Download source code for the Customizing Splash Screen example to experiment further.