• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Preloader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中javafx.application.Preloader的典型用法代码示例。如果您正苦于以下问题:Java Preloader类的具体用法?Java Preloader怎么用?Java Preloader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Preloader类属于javafx.application包,在下文中一共展示了Preloader类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: init

import javafx.application.Preloader; //导入依赖的package包/类
@Override
public void init() throws Exception {
	int progress = 0;

	applicationDataManager = new ApplicationDataManager();
	locale = ApplicationProperty.LOCALE.get(ApplicationDataManager.getApplicationProperties());

	if (!containsUnamedLaunchParameter(ProgramArgument.NoSplash)) {
		for (; progress < 100; progress++) {
			Thread.sleep(40);
			notifyPreloaderLog(new Preloader.ProgressNotification(progress / 100.0));
		}
	}


}
 
开发者ID:kayler-renslow,项目名称:arma-dialog-creator,代码行数:17,代码来源:ArmaDialogCreator.java


示例2: init

import javafx.application.Preloader; //导入依赖的package包/类
@Override
public void init() throws Exception {
	appInstance = this;
	VERSION = getVersion();

	// Lets install/update the overlays if newer version
	AppSetup.install(VERSION);
	log = LogManager.getLogger(TokenTool.class);
	log.info("3D Hardware Available? " + Platform.isSupported(ConditionalFeature.SCENE3D));

	// Now lets cache any overlays we find and update preLoader with progress
	overlayCount = (int) Files.walk(AppConstants.OVERLAY_DIR.toPath()).filter(Files::isRegularFile).count();
	overlayTreeItems = cacheOverlays(AppConstants.OVERLAY_DIR, null, THUMB_SIZE);

	// All Done!
	notifyPreloader(new Preloader.ProgressNotification(1.0));
}
 
开发者ID:RPTools,项目名称:tokentool,代码行数:18,代码来源:TokenTool.java


示例3: notifyPreloaderLog

import javafx.application.Preloader; //导入依赖的package包/类
private void notifyPreloaderLog(Preloader.PreloaderNotification notification) {
	if (containsUnamedLaunchParameter(ProgramArgument.LogInitProgress)) {
		if (notification instanceof Preloader.ProgressNotification) {
			System.out.println("Preloader Log Progress: " + ((Preloader.ProgressNotification) notification).getProgress());
		} else if (notification instanceof Preloader.StateChangeNotification) {
			System.out.println("Preloader Stage Change: " + ((Preloader.StateChangeNotification) notification).getType());
		} else if (notification instanceof Preloader.ErrorNotification) {
			System.out.println("Preloader Error: " + notification);
		}
	}
	notifyPreloader(notification);
}
 
开发者ID:kayler-renslow,项目名称:arma-dialog-creator,代码行数:13,代码来源:ArmaDialogCreator.java


示例4: handleApplicationNotification

import javafx.application.Preloader; //导入依赖的package包/类
@Override
public void handleApplicationNotification(Preloader.PreloaderNotification pn) {

    if (pn instanceof Preloader.StateChangeNotification) {
        stage.hide();
    }
}
 
开发者ID:tloszabno,项目名称:FirefightersCenter,代码行数:8,代码来源:AppPreloader.java


示例5: start

import javafx.application.Preloader; //导入依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
  notifyPreloader(new Preloader.StateChangeNotification(Preloader.StateChangeNotification.Type.BEFORE_START));
  stage.setTitle("Post Firefighters App");
  Scene scene = firefightersRootPane.initScene();
  stage.setScene(scene);

  URL resource = FirefighterPostApp.class.getClassLoader().getResource("ui.css");
  scene.getStylesheets().add(resource.toExternalForm());

  stage.setResizable(true);
  stage.centerOnScreen();
  stage.show();
  LOG.info("Application Started");
}
 
开发者ID:tloszabno,项目名称:FirefightersCenter,代码行数:16,代码来源:FirefighterPostApp.java


示例6: init

import javafx.application.Preloader; //导入依赖的package包/类
@Override
public void init() throws IOException {
  parsedArgs = commandLineHelper.parse(getParameters().getRaw());

  if (parsedArgs.hasOption(UICommandLineHelper.HEADLESS_OPTION)) {
    // If --headless was specified on the command line,
    // run in headless mode (only use the core module)
    logger.info("Launching GRIP in headless mode");
    injector = Guice.createInjector(Modules.override(new GripCoreModule(), new GripFileModule(),
        new GripSourcesHardwareModule()).with(new GripNetworkModule()));
    injector.injectMembers(this);

    headless = true;
  } else {
    // Otherwise, run with both the core and UI modules, and show the JavaFX stage
    logger.info("Launching GRIP in UI mode");
    injector = Guice.createInjector(Modules.override(new GripCoreModule(), new GripFileModule(),
        new GripSourcesHardwareModule()).with(new GripNetworkModule(), new GripUiModule()));
    injector.injectMembers(this);
    notifyPreloader(new Preloader.ProgressNotification(0.15));

    System.setProperty("prism.lcdtext", "false");
    Font.loadFont(this.getClass().getResource("roboto/Roboto-Regular.ttf").openStream(), -1);
    Font.loadFont(this.getClass().getResource("roboto/Roboto-Bold.ttf").openStream(), -1);
    Font.loadFont(this.getClass().getResource("roboto/Roboto-Italic.ttf").openStream(), -1);
    Font.loadFont(this.getClass().getResource("roboto/Roboto-BoldItalic.ttf").openStream(), -1);
    notifyPreloader(new Preloader.ProgressNotification(0.3));
  }

  notifyPreloader(new Preloader.ProgressNotification(0.45));
  server.addHandler(pipelineSwitcher);
  notifyPreloader(new Preloader.ProgressNotification(0.6));

  pipelineRunner.startAsync();
  notifyPreloader(new Preloader.ProgressNotification(0.75));
}
 
开发者ID:WPIRoboticsProjects,项目名称:GRIP,代码行数:37,代码来源:Main.java


示例7: cacheOverlays

import javafx.application.Preloader; //导入依赖的package包/类
/**
 * 
 * @author Jamz
 * @throws IOException
 * @since 2.0
 * 
 *        This method loads and processes all the overlays found in user.home/overlays and it can take a minute to load as it creates thumbnail versions for the comboBox so we call this during the
 *        init and display progress in the preLoader (splash screen).
 * 
 */
private TreeItem<Path> cacheOverlays(File dir, TreeItem<Path> parent, int THUMB_SIZE) throws IOException {
	TreeItem<Path> root = new TreeItem<>(dir.toPath());
	root.setExpanded(false);

	log.debug("caching " + dir.getAbsolutePath());

	File[] files = dir.listFiles();
	for (File file : files) {
		if (file.isDirectory()) {
			cacheOverlays(file, root, THUMB_SIZE);
		} else {
			Path filePath = file.toPath();
			TreeItem<Path> imageNode = new TreeItem<>(filePath, ImageUtil.getOverlayThumb(new ImageView(), filePath));
			root.getChildren().add(imageNode);

			notifyPreloader(new Preloader.ProgressNotification((double) loadCount++ / overlayCount));
		}
	}

	if (parent != null) {
		// When we show the overlay image, the TreeItem value is "" so we need to
		// sort those to the bottom for a cleaner look and keep sub dir's at the top.
		// If a node has no children then it's an overlay, otherwise it's a directory...
		root.getChildren().sort(new Comparator<TreeItem<Path>>() {
			@Override
			public int compare(TreeItem<Path> o1, TreeItem<Path> o2) {
				if (o1.getChildren().size() == 0 && o2.getChildren().size() == 0)
					return 0;
				else if (o1.getChildren().size() == 0)
					return Integer.MAX_VALUE;
				else if (o2.getChildren().size() == 0)
					return Integer.MIN_VALUE;
				else
					return o1.getValue().compareTo(o2.getValue());
			}
		});

		parent.getChildren().add(root);
	}

	return root;
}
 
开发者ID:RPTools,项目名称:tokentool,代码行数:53,代码来源:TokenTool.java


示例8: start

import javafx.application.Preloader; //导入依赖的package包/类
@Override
public void start(Stage stage) throws Exception {

	notifyPreloader(new Preloader.StateChangeNotification(Preloader.StateChangeNotification.Type.BEFORE_START));

	stage.setTitle(windowTitle);
	stage.setScene(new Scene(projectsView.getView()));
	stage.setResizable(true);
	stage.centerOnScreen();
	stage.show();
}
 
开发者ID:thomasdarimont,项目名称:spring-labs,代码行数:12,代码来源:App.java


示例9: start

import javafx.application.Preloader; //导入依赖的package包/类
@Override
public void start(Stage stage) throws Exception {

	notifyPreloader(new Preloader.StateChangeNotification(Preloader.StateChangeNotification.Type.BEFORE_START));

	stage.setTitle(windowTitle);
	stage.setScene(new Scene(mainLayout));
	stage.setResizable(true);
	stage.centerOnScreen();
	stage.show();
}
 
开发者ID:thomasdarimont,项目名称:spring-labs,代码行数:12,代码来源:App.java


示例10: start

import javafx.application.Preloader; //导入依赖的package包/类
@Override
public void start(Stage stage) throws IOException {
  // Load UI elements if we're not in headless mode
  if (!headless) {
    root = FXMLLoader.load(Main.class.getResource("MainWindow.fxml"), null, null,
        injector::getInstance);
    root.setStyle("-fx-font-size: " + DPIUtility.FONT_SIZE + "px");

    notifyPreloader(new Preloader.ProgressNotification(0.9));

    project.addIsSaveDirtyConsumer(newValue -> {
      if (newValue) {
        Platform.runLater(() -> stage.setTitle(MAIN_TITLE + " | Edited"));
      } else {
        Platform.runLater(() -> stage.setTitle(MAIN_TITLE));
      }
    });

    stage.setTitle(MAIN_TITLE);
    stage.getIcons().add(new Image("/edu/wpi/grip/ui/icons/grip.png"));
    stage.setScene(new Scene(root));
    notifyPreloader(new Preloader.ProgressNotification(1.0));
    notifyPreloader(new Preloader.StateChangeNotification(
        Preloader.StateChangeNotification.Type.BEFORE_START));
    stage.show();
  }

  operations.addOperations();
  cvOperations.addOperations();

  commandLineHelper.loadFile(parsedArgs, project);
  commandLineHelper.setServerPort(parsedArgs, settingsProvider, eventBus);

  // This will throw an exception if the port specified by the save file or command line
  // argument is already taken. Since we have to have the server running to handle remotely
  // loading pipelines and uploading images, as well as potential HTTP publishing operations,
  // this will cause the program to exit.
  try {
    server.start();
  } catch (GripServerException e) {
    logger.log(Level.SEVERE, "The HTTP server could not be started", e);
    Alert alert = new Alert(Alert.AlertType.CONFIRMATION, "", ButtonType.YES, ButtonType.NO);
    alert.setTitle("The HTTP server could not be started");
    alert.setHeaderText("The HTTP server could not be started");
    alert.setContentText(
        "This is normally caused by the network port being used by another process.\n\n"
            + "HTTP sources and operations will not work until GRIP is restarted. "
            + "Continue without HTTP functionality anyway?"
    );
    alert.showAndWait().filter(ButtonType.NO::equals).ifPresent(bt -> SafeShutdown.exit(1));
  }
}
 
开发者ID:WPIRoboticsProjects,项目名称:GRIP,代码行数:53,代码来源:Main.java


示例11: main

import javafx.application.Preloader; //导入依赖的package包/类
public static void main(String[] args) {
	Preloader.launch(args);
}
 
开发者ID:SaiPradeepDandem,项目名称:javafx-demos,代码行数:4,代码来源:PreloaderCheck.java



注:本文中的javafx.application.Preloader类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RequiredModelMBean类代码示例发布时间:2022-05-21
下一篇:
Java JulianFields类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap