users
[Top] [All Lists]

Splash Screen from an executable jar

To: users@xxxxxxxxxx
Subject: Splash Screen from an executable jar
From: Steve Metter <smetter@xxxxxxxxxxxxxxxx>
Date: Wed, 12 May 2004 04:16:17 -0700 (PDT)
Delivered-to: mailing list users@cinjug.org
Mailing-list: contact users-help@cinjug.org; run by ezmlm
My application displays a splash screen when it starts by putting up a
JLabel containing an ImageIcon containing a PNG file. The entire snippet
of code looks like this:

JLabel label = new JLabel(new ImageIcon(filename));
getContentPane().add(label, BorderLayout.CENTER);
pack();
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension labelSize = label.getPreferredSize();
setLocation(MainPanel.HORIZONTAL_SIZE/2 - (labelSize.width/2),
                MainPanel.VERTICAL_SIZE/2 - (labelSize.height/2));
setVisible(true);

It works just fine on my development machine, but the splash screen fails
to display when I run the application as an executable jar.

I've proven that the right code and the image file are all contained in
the jar, and everything else about the application works from the jar
(including other PNG images).

I am not running it as a separate thread, because it doesn't need to be
(although I believe I've eliminated that as the cause of the problem).

Is there something magic about running from an executable jar that would
affect how image files work or how a splash screen works or something?

Thanks for any ideas that anyone can suggest.


<Prev in Thread] Current Thread [Next in Thread>