Created spesific package for every fxml
I have come to conclusoin (after few projects inspection) thatevery fxml should have his own conroller and its own java class that represents it and loads it.voting-station-gui
parent
357fab2d96
commit
213ab2a4ea
|
@ -2,46 +2,15 @@ package splash_screen_on_boot;
|
||||||
|
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.scene.Node;
|
|
||||||
import javafx.scene.Parent;
|
import javafx.scene.Parent;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.ThreadFactory;
|
|
||||||
|
|
||||||
public class Main extends Application {
|
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 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 {
|
private Parent loadStartingPanel(Stage primaryStage) throws IOException {
|
||||||
Parent root = FXMLLoader.load(getClass().getResource(SPALSH_SCREEN_ON_BOOT_FXML_PATH));
|
Parent root = FXMLLoader.load(getClass().getResource(SPALSH_SCREEN_ON_BOOT_FXML_PATH));
|
||||||
|
@ -51,17 +20,9 @@ public class Main extends Application {
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeLoadingGif(Parent root) throws InterruptedException {
|
|
||||||
Node loadingGif = root.lookup("#LoadingGif");
|
|
||||||
loadingGif.setVisible(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start(Stage primaryStage) throws Exception{
|
public void start(Stage primaryStage) throws Exception{
|
||||||
Parent root = loadStartingPanel(primaryStage);
|
loadStartingPanel(primaryStage);
|
||||||
System.out.println(0);
|
|
||||||
loadAllFxmls();
|
|
||||||
//removeLoadingGif(root);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws InterruptedException {
|
public static void main(String[] args) throws InterruptedException {
|
||||||
|
|
Loading…
Reference in New Issue