Created loader of all next fxmls
Now we display the spalsh screen on boot then load all of the fxmlsvoting-station-gui
parent
7eb5aec1d1
commit
b76bd76854
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
@ -1,4 +0,0 @@
|
|||
package sample;
|
||||
|
||||
public class Controller {
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
package sample;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class Main extends Application {
|
||||
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws Exception{
|
||||
Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
|
||||
primaryStage.setTitle("Voting Station");
|
||||
primaryStage.setScene(new Scene(root, 560, 360));
|
||||
primaryStage.show();
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch(args);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package splash_screen_on_boot;
|
||||
|
||||
public class Controller {
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package splash_screen_on_boot;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
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;
|
||||
|
||||
public class Main extends Application {
|
||||
|
||||
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/").getPath().replace("%20", " ");
|
||||
List<String> filesNames = listFilesForFolder(new File(fxmlsFolderPath));
|
||||
return filesNames;
|
||||
}
|
||||
|
||||
private List<Parent> Boards;
|
||||
|
||||
private void loadAllFxmls() throws IOException {
|
||||
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"));
|
||||
primaryStage.setTitle("Voting Station");
|
||||
primaryStage.setScene(new Scene(root, 560, 360));
|
||||
primaryStage.show();
|
||||
|
||||
loadAllFxmls();
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch(args);
|
||||
}
|
||||
}
|
|
@ -11,7 +11,7 @@
|
|||
<?import javafx.scene.control.Label?>
|
||||
|
||||
|
||||
<GridPane alignment="center" hgap="10" vgap="10" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8" fx:controller="sample.Controller">
|
||||
<GridPane alignment="center" hgap="10" vgap="10" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8" fx:controller="splash_screen_on_boot.Controller">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints />
|
||||
<ColumnConstraints />
|
||||
|
@ -61,7 +61,7 @@
|
|||
<children>
|
||||
<ImageView AnchorPane.leftAnchor="65.0" AnchorPane.rightAnchor="65.0" GridPane.columnIndex="1">
|
||||
<image>
|
||||
<Image url="@../Gifs/712%20(1).gif" />
|
||||
<Image url="@../../gifs/loadingGif.gif" />
|
||||
</image>
|
||||
<GridPane.margin>
|
||||
<Insets left="60.0" />
|
Loading…
Reference in New Issue