
com.github.athi.athifx.gui.application.WaitingScreen Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of athi-fx-gui Show documentation
Show all versions of athi-fx-gui Show documentation
AthiFX project for creating JavaFX simple application GUI.
The newest version!
package com.github.athi.athifx.gui.application;
import javafx.concurrent.Task;
import javafx.scene.control.Label;
import javafx.scene.control.ProgressBar;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import static com.github.athi.athifx.gui.configuration.ApplicationConfiguration.WAITING_FOR_COMPLETION_MESSAGE;
/**
* Created by Athi
*/
public class WaitingScreen extends AbstractScreen {
private Stage waitingScreen;
public void show(Task> task) {
waitingScreen = new Stage();
waitingScreen.initStyle(StageStyle.UNDECORATED);
waitingScreen.setResizable(false);
waitingScreen.initModality(Modality.APPLICATION_MODAL);
AnchorPane root = prepareRoot(waitingScreen);
root.setPrefWidth(400);
root.setPrefHeight(40);
ProgressBar progressBar = new ProgressBar();
progressBar.progressProperty().bind(task.progressProperty());
Label infoLabel = new Label(WAITING_FOR_COMPLETION_MESSAGE);
root.getChildren().addAll(progressBar, infoLabel);
setAnchors(progressBar, 2.0, 2.0, 2.0, 2.0);
setAnchors(infoLabel, 8.0, 2.0, 2.0, 2.0);
waitingScreen.show();
}
public void close() {
if (waitingScreen.isShowing()) {
waitingScreen.close();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy