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();
}
这段代码主要实现了一个 SplashWindow 窗口的初始化。定义了相关的面板和坐标、尺寸变量,在构造函数中获取内容面板,设置布局,计算窗口位置和大小,将面板添加到窗口并显示。
1835

被折叠的 条评论
为什么被折叠?



