Customizing JavaFX Splash Screen

By Vaibhav Choudhary, April 24, 2009

With the JavaFX technology it is easy to build your own customized Splash Screen in place of Default Java Logo.

Understanding the Code

The code shown in Figure 1 creates JavaFX Custom Splash Screen, which enables the user to easily replace the default splash screen of Java Logo. The user can define few parameters in html applet page like loading_image_url, loading_image_height, loading_image_width.

Source Code

              archive: "CustomSplashScreen.jar",
              draggable: true,
              width: 400,
              height: 250,
              loading_image_url: "http://blogs.sun.com/vaibhav/resource/Splash_javafx.gif"
			  loading_image_height: 128
			  loading_image_width: 128
			  code: "customsplashscreen.Main",
              name: "CustomSplashScreen"
        }
    );

Figure 1: Applet HTML Page for CustomSplashScreen

Changing Parameters such as loading_image_url,loading_image_height, loading_image_width is easy in CustomSplashScreen.html

Main.fx
Source Code
var vis = false;  //Sets visibility of Close button
var media = Media {
    source: "http://sun.edgeboss.net/download/sun/media/1460825906/1460825906_2956241001_big-buck-bunny-640x360.flv"
}
var mediaPlayer =  MediaPlayer {
    autoPlay: true
    media: media
                }
var mediaView = MediaView {
    translateY: 20
    fitWidth: 400
    mediaPlayer: mediaPlayer
            }

Figure 2: Code for Media Player

Source Code
extensions: [
        AppletStageExtension {
            onDragStarted: function() {
                vis = true;

            }
            onAppletRestored: function() {
                vis  = false;
            }
            useDefaultClose: false
        }
    ]


Figure 4: Screen Capture of Splash Image