I show here an image of my welcome scene.
The current behavior of the Create New Project button is shown here:
Stage stage = (Stage)(
You should try adding in ControlsFX this will help.
You can do the following:
Service<T> service = new Service<T>(){
@Override
protected Task<T> createTask() {
return new Task<T>() {
@Override
protected T call() throws Exception {
//Do your processing here. }
};
}
};
service.setOnSucceeded(event -> {//do your processing});
service.setOnFailed(event -> {//do your processing});
ProgressDialog pd = new ProgressDialog(service);
pd.setContentText("Please wait while the window loads...");
pd.initModality(Modality.WINDOW_MODAL);
pd.initOwner(stage);
service.start();
This will put your code on the background thread. ControlsFX dialogs start and stop with the service.
Instead of sleeping the thread, use a PauseTransition and load your new scene after the pause has finished.
createNewProject.setOnAction(event -> {
statusText.setText("Please wait...");
PauseTransition pause = new PauseTransition(
Duration.seconds(1),
);
pause.setOnFinished(event -> {
Parent root = FXMLLoader.load(
getClass().getResource(
"/view/scene/configure/NewProjectConfigureScene.fxml"
)
);
Scene scene = new Scene(root);
stage.setTitle("Configure New Project Settings");
stage.setScene(scene);
stage.sizeToScene();
});
pause.play();
});
The above code assumes you have just a single stage, so you resize your "Welcome" stage to become the "Configure New Project Settings" stage.