我的软件在做完以后,要求在启动完成以前加载一个图片的欢迎界面。
这个功能许多软件都有,象Word, photoshop,Eclipse等,
那么应当如何加载呢?
是不是用JFrame或者JDialog实现,那么它的属性应当如何设置呢?
这个功能许多软件都有,象Word, photoshop,Eclipse等,
那么应当如何加载呢?
是不是用JFrame或者JDialog实现,那么它的属性应当如何设置呢?
调试欢乐多
这个JDK自带的例子就有一个你的要求的欢迎界面
* Show the spash screen while the rest of the demo loads
*/
public void createSplashScreen() {
splashLabel = new JLabel(createImageIcon("Splash.jpg", "Splash.accessible_description"));
if(!isApplet()) {
splashScreen = new JWindow(getFrame());
splashScreen.getContentPane().add(splashLabel);
splashScreen.pack();
Rectangle screenRect = getFrame().getGraphicsConfiguration().getBounds();
splashScreen.setLocation(
screenRect.x + screenRect.width/2 - splashScreen.getSize().width/2,
screenRect.y + screenRect.height/2 - splashScreen.getSize().height/2);
}
}
SwingUtilities.invokeLater(new Runnable() {
public void run() {
showSplashScreen();
}
});