mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-13 09:26:11 -04:00
show progress (as number) in startup window
This commit is contained in:
parent
645ce43316
commit
066535be40
@ -20,6 +20,7 @@ import de.bixilon.minosoft.util.CountUpAndDownLatch;
|
|||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.scene.control.Dialog;
|
import javafx.scene.control.Dialog;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.ProgressBar;
|
import javafx.scene.control.ProgressBar;
|
||||||
import javafx.scene.layout.GridPane;
|
import javafx.scene.layout.GridPane;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
@ -41,14 +42,16 @@ public class StartProgressWindow extends Application {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AtomicReference<ProgressBar> progressBar = new AtomicReference<>();
|
AtomicReference<ProgressBar> progressBar = new AtomicReference<>();
|
||||||
|
AtomicReference<Label> progressLabel = new AtomicReference<>();
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
progressDialog = new Dialog<>();
|
progressDialog = new Dialog<>();
|
||||||
progressDialog.setTitle(LocaleManager.translate(Strings.MINOSOFT_STILL_STARTING_TITLE));
|
progressDialog.setTitle(LocaleManager.translate(Strings.MINOSOFT_STILL_STARTING_TITLE));
|
||||||
progressDialog.setHeaderText(LocaleManager.translate(Strings.MINOSOFT_STILL_STARTING_HEADER));
|
progressDialog.setHeaderText(LocaleManager.translate(Strings.MINOSOFT_STILL_STARTING_HEADER));
|
||||||
GridPane grid = new GridPane();
|
GridPane grid = new GridPane();
|
||||||
progressBar.set(new ProgressBar());
|
progressBar.set(new ProgressBar());
|
||||||
progressBar.get().setProgress(1.0F - ((float) progress.getCount() / progress.getTotal()));
|
progressLabel.set(new Label());
|
||||||
grid.add(progressBar.get(), 0, 0);
|
grid.add(progressBar.get(), 0, 0);
|
||||||
|
grid.add(progressLabel.get(), 1, 0);
|
||||||
progressDialog.getDialogPane().setContent(grid);
|
progressDialog.getDialogPane().setContent(grid);
|
||||||
if (exit) {
|
if (exit) {
|
||||||
return;
|
return;
|
||||||
@ -66,7 +69,10 @@ public class StartProgressWindow extends Application {
|
|||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
Platform.runLater(() -> progressBar.get().setProgress(1.0F - ((float) progress.getCount() / progress.getTotal())));
|
Platform.runLater(() -> {
|
||||||
|
progressBar.get().setProgress(1.0F - ((float) progress.getCount() / progress.getTotal()));
|
||||||
|
progressLabel.get().setText(String.format("%d / %d", (progress.getTotal() - progress.getCount()), progress.getTotal()));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
hideDialog();
|
hideDialog();
|
||||||
}).start();
|
}).start();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user