MyThinkPond

On Java, Python, Groovy, Grails, Spring, Node.js, Linux, Arduino, ARM, Embedded Devices & Web

  • Recent Posts

    April 2010
    M T W T F S S
    « Mar   May »
     1234
    567891011
    12131415161718
    19202122232425
    2627282930  
  • Subscribe Options

  • Awards

    JavaCodeGeeks
  • Most Valuable Blogger @ DZone
  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 173 other followers

  • Follow MyThinkPond on WordPress.com
  • Blog Stats

    • 364,698 hits
  • General Options

Java 6 Gems: Spash Screen for your application

Posted by Venkatt Guhesan on April 12, 2010

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:

http://www.myapplication.com/getVersion.jsp?ver=1.2.3

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.

Cheers.

If you find this article useful, consider signing up for my RSS feed or Email Newsletter. See links on the right side.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: