我开发这个应用程序,我需要显示启动画面3秒。问题是飞溅窗口在三秒钟内是空白的,并且飞溅图像仅在屏幕上出现主舞台后才显示。任何帮助将非常感激。 继承人我的代码javafx - 启动画面不显示
class Launcher extends Application {
@Override
public void start(Stage stage) {
Pane splashLayout = new VBox();
ImageView splashImage = new ImageView(new Image(getClass().getResourceAsStream("splash/splash.png")));
splashLayout.getChildren().add(splashImage);
Scene scene = new Scene(splashLayout, Color.TRANSPARENT);
stage.initStyle(StageStyle.TRANSPARENT);
stage.setScene(scene);
stage.show();
Thread.sleep(3000); // wait for three seconds.
Window window = new Window(); // main stage
window.show();
stage.hide();
}
}
现在这里的问题是显示窗口舞台后显示的开机画面。
更新:当我把这个类变成Preloader类(即扩展Preloader类)并注释掉这两行时,闪屏图像显示出来。 窗口窗口=新窗口(); // window.show();// – bazi 2015-04-04 04:31:45