【发布时间】:2015-08-07 16:42:46
【问题描述】:
我创建了一个 Preloader(基于以下教程),它应该显示主应用程序的启动屏幕。
9.3.4 使用预加载器显示应用程序初始化进度 http://docs.oracle.com/javafx/2/deployment/preloaders.htm
public class SplashScreenLoader extends Preloader {
private Stage splashScreen;
@Override
public void start(Stage stage) throws Exception {
splashScreen = stage;
splashScreen.setScene(createScene());
splashScreen.show();
}
public Scene createScene() {
StackPane root = new StackPane();
Scene scene = new Scene(root, 300, 200);
return scene;
}
@Override
public void handleApplicationNotification(PreloaderNotification notification) {
if (notification instanceof StateChangeNotification) {
splashScreen.hide();
}
}
}
每次在我的 IDE (IntelliJ IDEA) 中运行主应用程序时,我都想运行预加载器。
我还遵循了 IntelliJ 中预加载器的打包规则: https://www.jetbrains.com/idea/help/applications-with-a-preloader-project-organization-and-packaging.html
当我运行主应用程序时,预加载器没有启动,所以我想我错过了一些东西。我是 Preloaders 的新手,我不明白在独立应用程序中将主应用程序与预加载器连接的机制是什么。
【问题讨论】:
标签: javafx splash-screen preloader