How to create splash screen as a Preloader in JavaFX standalone application?

前端 未结 3 746
说谎
说谎 2021-01-11 17:33

I created a Preloader (based on the following tutorial) that should display a splash screen for the main application.

9.3.4 Using a Preloader to Display the Applicat

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-11 17:55

    You can run using LauncherImpl like this . . .

    public class Main {
       public static void main(String[] args) {
          LauncherImpl.launchApplication(MyApplication.class, SplashScreenLoader.class, args);
       }
    }
    

    And the class MyApplication would be like this . . .

    public class MyApplication extends Application {
    
        @Override
        public void start(Stage primaryStage) {
            ....
            primaryStage.show();
        }
        public static void main(String[] args) {
            launch(args);
        }
    }
    

提交回复
热议问题