parent
b76bd76854
commit
6d01be0d13
|
@ -2,6 +2,7 @@ package splash_screen_on_boot;
|
|||
|
||||
import javafx.application.Application;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.stage.Stage;
|
||||
|
@ -10,9 +11,12 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
public class Main extends Application {
|
||||
|
||||
private static final String SPALSH_SCREEN_ON_BOOT_FXML_PATH = "fxmls/spalsh_screen_on_boot.fxml";
|
||||
|
||||
private List<String> listFilesForFolder(File folder) {
|
||||
List<String> filesNames = new ArrayList<>();
|
||||
for (final File fileEntry : folder.listFiles())
|
||||
|
@ -31,26 +35,34 @@ public class Main extends Application {
|
|||
|
||||
private List<Parent> Boards;
|
||||
|
||||
private void loadAllFxmls() throws IOException {
|
||||
private void loadAllFxmls() throws IOException, InterruptedException {
|
||||
Boards = new ArrayList<>();
|
||||
for (String filename : getNamesOfAllFxmls()) {
|
||||
Boards.add(FXMLLoader.load(getClass().getResource("fxmls/" + filename)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws Exception{
|
||||
|
||||
Parent root = FXMLLoader.load(getClass().getResource("fxmls/spalsh_screen_on_boot.fxml"));
|
||||
private Parent loadStartingPanel(Stage primaryStage) throws IOException {
|
||||
Parent root = FXMLLoader.load(getClass().getResource(SPALSH_SCREEN_ON_BOOT_FXML_PATH));
|
||||
primaryStage.setTitle("Voting Station");
|
||||
primaryStage.setScene(new Scene(root, 560, 360));
|
||||
primaryStage.show();
|
||||
|
||||
loadAllFxmls();
|
||||
return root;
|
||||
}
|
||||
|
||||
private void removeLoadingGif(Parent root) throws InterruptedException {
|
||||
Node loadingGif = root.lookup("#LoadingGif");
|
||||
loadingGif.setVisible(false);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws Exception{
|
||||
Parent root = loadStartingPanel(primaryStage);
|
||||
loadAllFxmls();
|
||||
removeLoadingGif(root);
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws InterruptedException {
|
||||
launch(args);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
<children>
|
||||
<AnchorPane GridPane.columnIndex="1">
|
||||
<children>
|
||||
<ImageView AnchorPane.leftAnchor="65.0" AnchorPane.rightAnchor="65.0" GridPane.columnIndex="1">
|
||||
<ImageView fx:id="LoadingGif" AnchorPane.leftAnchor="65.0" AnchorPane.rightAnchor="65.0" GridPane.columnIndex="1">
|
||||
<image>
|
||||
<Image url="@../../gifs/loadingGif.gif" />
|
||||
</image>
|
||||
|
|
Loading…
Reference in New Issue