private SplashPanel SPLASHPANEL=new SplashPanel();
private int splash_x;
private int splash_y;
private int splash_w;
private int splash_h;
private Container con;
public SplashWindow()
{
con=getContentPane();
con.setLayout(new BorderLayout());
Dimension screensize=Toolkit.getDefaultToolkit().getScreenSize();
Dimension splashsize=SPLASHPANEL.getPreferredSize();
splash_w=splashsize.width;
splash_h=splashsize.height;
splash_x=(int)((screensize.width-splash_w)/2);
splash_y=(int)((screensize.height-splash_h)/2);
con.add(SPLASHPANEL,BorderLayout.CENTER);
setBounds(splash_x,splash_y,splash_w,splash_h);
show();
}
frame = new MyWindow();
frame.setLocationRelativeTo(null);
setLocation()方法