Dialogs for your JavaFX
JAVAFX PROGRESSDIALOG EXAMPLE
Here is an example of a progress dialog
That counts from 1 to 20.
@Override
public void start(Stage primaryStage) {
Task<Void> task=new Task<Void>(){
@Override
protected Void call() throws Exception {
for (int i = 1; i <= 20; i++) {
Thread.sleep(500);
updateProgress(i , 20);
updateMessage("Am at index " + (i));
}
return null;
}
};
Dialogs.create()
.owner(primaryStage)
.title("Progress Dialog")
.masthead("Counting 1-20")
.showWorkerProgress(task);
Thread th=new Thread(task);
th.start();
Scene scene = new Scene(new StackPane(),500,500);
primaryStage.setTitle("Progress Dialog");
primaryStage.setScene(scene);
primaryStage.show();
}
Results
Comments
Post a Comment