javafx.application.Preloader Java Examples

The following examples show how to use javafx.application.Preloader. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ArmaDialogCreator.java    From arma-dialog-creator with MIT License 7 votes vote down vote up
@Override
public void init() throws Exception {
	ApplicationManager.instance.initializeADC();

	Thread t = new Thread(() -> {
		int progress = 0;
		if (!containsUnnamedLaunchParameter(ProgramArgument.NoSplash)) {
			for (; progress < 100; progress++) {
				try {
					Thread.sleep(40);
				} catch (InterruptedException ignore) {

				}
				notifyPreloaderLog(new Preloader.ProgressNotification(progress / 100.0));
			}
		}
	});

	t.start();
	t.join();
}
 
Example #2
Source File: Loader.java    From DashboardFx with GNU General Public License v3.0 6 votes vote down vote up
@Override
public synchronized void handleApplicationNotification(Preloader.PreloaderNotification info) {
    // Handle application notification in this point (see MyApplication#Init).

    if (info instanceof Preloader.ProgressNotification) {
        double x = ((Preloader.ProgressNotification) info).getProgress();

        double percent = x / 100f;
        progressBar.progressProperty().set(percent > 1 ? 1 : percent);
    }
}
 
Example #3
Source File: App.java    From spring-labs with Apache License 2.0 6 votes vote down vote up
@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();
}
 
Example #4
Source File: App.java    From spring-labs with Apache License 2.0 6 votes vote down vote up
@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();
}
 
Example #5
Source File: ArmaDialogCreator.java    From arma-dialog-creator with MIT License 5 votes vote down vote up
private void notifyPreloaderLog(Preloader.PreloaderNotification notification) {
	if (containsUnnamedLaunchParameter(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);
}
 
Example #6
Source File: App.java    From DashboardFx with GNU General Public License v3.0 4 votes vote down vote up
private synchronized void preloaderNotify() {
    progress += increment;
    LauncherImpl.notifyPreloader(this, new Preloader.ProgressNotification(progress));
}