import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
class SplashWindow2 extends JWindow
{
public SplashWindow2(String filename, Frame f)
public SplashWindow2()
{
super(f);
//Frame f = new Frame();
JLabel l = new JLabel(new ImageIcon(filename));
this.getContentPane().add(l, BorderLayout.CENTER);
pack();
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension labelSize = l.getPreferredSize();
setLocation(screenSize.width/2 - (labelSize.width/2),
screenSize.height/2 - (labelSize.height/2));
addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent e)
{
setVisible(false);
dispose();
}
});
setVisible(true);
}
public static void main(String args[])
{
//System.out.println("Splash window example");
new SplashWindow2("C:/Documents and Settings/vplapid/Desktop/Java/icms.jpg",????????);
}
}
I'm very new to Java and trying to make a splash window. I can't figure out what value or object to be pass on the parameter of the constructor.
Any help would be appreciated.
import java.awt.event.*;
import java.awt.*;
class SplashWindow2 extends JWindow
{
public SplashWindow2(String filename, Frame f)
public SplashWindow2()
{
super(f);
//Frame f = new Frame();
JLabel l = new JLabel(new ImageIcon(filename));
this.getContentPane().add(l, BorderLayout.CENTER);
pack();
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension labelSize = l.getPreferredSize();
setLocation(screenSize.width/2 - (labelSize.width/2),
screenSize.height/2 - (labelSize.height/2));
addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent e)
{
setVisible(false);
dispose();
}
});
setVisible(true);
}
public static void main(String args[])
{
//System.out.println("Splash window example");
new SplashWindow2("C:/Documents and Settings/vplapid/Desktop/Java/icms.jpg",????????);
}
}
I'm very new to Java and trying to make a splash window. I can't figure out what value or object to be pass on the parameter of the constructor.
Any help would be appreciated.