71 lines
2.2 KiB
Java
71 lines
2.2 KiB
Java
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;
|
|
|
|
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 static final String FXMLS_DIRECTORY_PATH = "../fxmls/";
|
|
|
|
private List<String> listFilesForFolder(File folder) {
|
|
List<String> filesNames = new ArrayList<>();
|
|
for (final File fileEntry : folder.listFiles())
|
|
{
|
|
filesNames.add(fileEntry.getName());
|
|
}
|
|
|
|
return filesNames;
|
|
}
|
|
|
|
private List<String> getNamesOfAllFxmls() throws IOException {
|
|
String fxmlsFolderPath = getClass().getResource(FXMLS_DIRECTORY_PATH).getPath().replace("%20", " ");
|
|
List<String> filesNames = listFilesForFolder(new File(fxmlsFolderPath));
|
|
return filesNames;
|
|
}
|
|
|
|
private List<Parent> Boards;
|
|
|
|
private void loadAllFxmls() throws IOException, InterruptedException {
|
|
Boards = new ArrayList<>();
|
|
for (String filename : getNamesOfAllFxmls()) {
|
|
Boards.add(FXMLLoader.load(getClass().getResource(FXMLS_DIRECTORY_PATH + filename)));
|
|
}
|
|
}
|
|
|
|
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();
|
|
return root;
|
|
}
|
|
|
|
private void removeLoadingGif(Parent root) throws InterruptedException {
|
|
Node loadingGif = root.lookup("#LoadingGif");
|
|
loadingGif.setVisible(false);
|
|
}
|
|
|
|
@Override
|
|
public void start(Stage primaryStage) throws Exception{
|
|
Parent root = loadStartingPanel(primaryStage);
|
|
System.out.println(0);
|
|
loadAllFxmls();
|
|
//removeLoadingGif(root);
|
|
}
|
|
|
|
public static void main(String[] args) throws InterruptedException {
|
|
launch(args);
|
|
}
|
|
}
|