Splash screen shows blank
Gday
Can someone with a bit of expirence in Java help, i have a class that
call displays my screen in a thread that dies after 8 sec, but my
image does not appear. here is the code. Is the something i am
overlooking?
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Toolkit;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JWindow;
import javax.swing.border.LineBorder;
public class splashS extends JWindow {
JPanel screenPane;
/** Creates a new instance of splashS */
public splashS() {
setBackground(Color.WHITE);
}
public void showSplash()
{
JPanel screenPane = (JPanel)getContentPane();
screenPane.setBackground(Color.WHITE);
int width = 450;
int height =115;
Dimension screen =
Toolkit.getDefaultToolkit().getScreenSize();
int x = (screen.width-width)/2;
int y = (screen.height-height)/2;
setBounds(x,y,width,height);
screenPane.setLayout(new FlowLayout());
JLabel label = new JLabel(new ImageIcon("images/
VibrantSplash.jpg"));
screenPane.add(label, BorderLayout.CENTER);
Color oraRed = new Color(156, 20, 20, 255);
screenPane.setBorder(BorderFactory.createLineBorder(oraRed,
10));
setVisible(true);
try
{
Thread.sleep(5000);
}
catch (Exception e)
{
e.printStackTrace();
}
dispose();
}
}