Mustang will be the next release of the Java Standard Edition (Java SE 6). At present Mustang is in beta, it will be delivered in Autumn 2006.
One of the new desktop features of Mustang is the capability of showing a splash screen even before the starting of the Java Virtual Machine.
You can configure the splash screen by command line:
java -splash:mysplash.gif MyApplication
…or, if your application is packaged in a JAR file, using the SplashScreen-Image option in the manifest file:
Manifest-Version: 1.0
Main-Class: MyApplication
SplashScreen-Image: mysplash.gif
For testing this new cool feature of Mustang, I wrote a small example, with some supporting classes. For trying it you can download the Splasher.jar file from here. Execute it using:
java -jar Splasher.jar
…of course you have to download and install Mustang. After the launch of the JVM the application can control and even drawing on the splash screen, retriving the SplashScreen object:
SplashScreen splash = SplashScreen.getSplashScreen();
Graphics2D g = (Graphics2D)splash.getGraphics();
Rectangle r = splash.getBounds();
FontMetrics fm = g.getFontMetrics();
// drawing a message at the bottom of the splash screen
g.drawString("Welcome!",
1, (int)r.getHeight()-1-fm.getDescent());
splash.update();
You can dismiss the splash screen using the close() method:
splash.close();
This call is usually not needed as the splash screen will be automatically closed when the first window of the application will be made visible.
Some useful links:
- SplashScreen javadoc
- A JDC TechTip
- An SDN article (little outdated, but still good)