Customizing the Loading Screen

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 screen
  • boxbgcolor - the background color of the area in which the applet will be displayed
  • boxborder - 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 AppletPage.html shows how to customize the splash screen to display an animation of the Duke, the Java mascot.

<script src=""></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'); 

Open AppletPage.html 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.

Note:  If you don't see the applet running, you need to install at least the Java SE Development Kit (JDK) 6 update 10 release.

Note:  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.