Steve,
I have an app that runs a Splash screen. I found the technique on the
Web, I don't remember where. I have attached my MainSplash.java and
SplashWindow.java classes which handle the splash screen display.
Hope this helps,
Dave Connerth
-----Original Message-----
From: Steve Metter [mailto:smetter@xxxxxxxxxxxxxxxx]
Sent: Wednesday, May 12, 2004 7:16 AM
To: users@xxxxxxxxxx
Subject: [cinjug-users] Splash Screen from an executable jar
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.
---------
You may unsubscribe from this mailing list
by sending a blank email addressed to:
users-unsubscribe@xxxxxxxxxx
--
Find additional help by sending a blank email
addressed to:
users-help@xxxxxxxxxx
MainSplash.java
Description: MainSplash.java
SplashWindow.java
Description: SplashWindow.java
|