In my coverage of all the new features that are part of Java SE 6, there is a new gem added that makes the user experience very clean and concise when you bring up a web-start or applet or desktop based Java application. Namely, the splash screen.
When you load up a native application, it’s very traditional to display a “splash screen” with the company logo and branding of the particular product. In the past, you had to write your own loader class that did this. But now Java has added support for it. Class - java.awt.SplashScreen does the job for you.
The splash screen is displayed as an undecorated window containing an image. You can use GIF, JPEG, and PNG files for the image. Animation (for GIF) and transparency (for GIF, PNG) are supported. The window is positioned at the center of the screen (the position on multi-monitor systems is not specified - it is platform and implementation dependent). The window is closed automatically as soon as the first window is displayed by Swing/AWT
- excerpt from the Java SplashScreen API
There are two ways to invoke the splash screen:
java -splash:filename.png MyApplication
or add it within your manifest.mf file like this
Manifest-Version: 1.0 Main-Class: Test SplashScreen-Image: filename.png
Now you have a common, concise way to display the splash screen. And if your application does anything like reloading classes or has a built in feature to restart certain parts of the application. You can even get the latest from a remote URL. Since it exposes, the following API [ setImageURL(URL imageURL) ], you can programatically invoke a URL like this on the server-side:
And this can return a binary stream of “content-type: image/png”. But on the back-end you can tally the number of folks using version 1.2.3, etc.
If you find this article useful, consider signing up for my RSS feed or Email Newsletter. See links on the right side.