JavaFX预加载器和Netbeans [英] JavaFX Preloader and Netbeans

查看:64
本文介绍了JavaFX预加载器和Netbeans的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用标准的JavaFX预加载程序模板.但是我不确定如何将其链接到我的JavaFX程序.

I am using the standard JavaFX preloader templete. But I am not sure how to link it to my JavaFX program.

public class FXPreloader extends Preloader {

    ProgressBar bar;
    Stage stage;
   .......
} 

这是我的主要

public class CIDCV extends Application {

 @Override
    public void start(Stage primaryStage) throws Exception {
        Parent root = FXMLLoader.load(getClass().getResource("Main.fxml"));
        Controller.stage=primaryStage;
        Scene scene = new Scene(root);
        Controller.stage.setScene(scene);
        Controller.stage.setResizable(false);
        Controller.stage.show();
    }
    public static void main(String[] args) {
      launch(args);
    }

}

我所需要的只是一个启动屏幕,指示程序正在启动.

All what I am looking for is a splash screen to indicate the program is starting.

推荐答案

  1. 选择应用程序项目
  2. 右键单击弹出菜单
  3. 在弹出菜单中选择Properties.
  4. 在对话框左侧的类别"中选择运行".
  5. 单击带圆圈的浏览按钮以选择预加载器的项目.
  1. Select the Application project
  2. Right-click for pop-up menu
  3. Select Properties in pop-up menu.
  4. Select Run in the Categories on the left side of dialog.
  5. Click the circled Browse button to select the project of your preloader.

请注意,对于本地的小型项目,预加载器可能运行得如此之快,甚至看不到它.我在handleProgressNotification()中放入Thread.sleep(1000)只是为了确保可以看到它.

Note for a small project locally the preloader might run so fast you can't even see it. I put in a Thread.sleep(1000) in handleProgressNotification() just to make sure I could see it.

请参见 https中标题为9.2.1在NetBeans IDE中打包预加载器应用程序的部分. ://docs.oracle.com/javafx/2/deployment/preloaders.htm

这篇关于JavaFX预加载器和Netbeans的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆