Creating splash screen on boot then the uploader BB
parent
213ab2a4ea
commit
c97910644f
|
@ -5,7 +5,7 @@
|
||||||
<?import javafx.scene.control.*?>
|
<?import javafx.scene.control.*?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.*?>
|
||||||
|
|
||||||
<GridPane alignment="center" hgap="10" vgap="10" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="splash_screen_on_boot.Controller">
|
<GridPane alignment="center" hgap="10" vgap="10" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="splash_screen_on_boot.java.SplashScreenOnBootController">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints />
|
<ColumnConstraints />
|
||||||
<ColumnConstraints />
|
<ColumnConstraints />
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<?import javafx.scene.control.Button?>
|
<?import javafx.scene.control.Button?>
|
||||||
<?import javafx.scene.control.Label?>
|
<?import javafx.scene.control.Label?>
|
||||||
|
|
||||||
<GridPane alignment="center" hgap="10" vgap="10" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="splash_screen_on_boot.Controller">
|
<GridPane alignment="center" hgap="10" vgap="10" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="splash_screen_on_boot.java.SplashScreenOnBootController">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints />
|
<ColumnConstraints />
|
||||||
<ColumnConstraints />
|
<ColumnConstraints />
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
package splash_screen_on_boot;
|
|
||||||
|
|
||||||
public class Controller {
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
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.IOException;
|
|
||||||
|
|
||||||
public class Main extends Application {
|
|
||||||
|
|
||||||
private static final String SPALSH_SCREEN_ON_BOOT_FXML_PATH = "../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();
|
|
||||||
return root;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void start(Stage primaryStage) throws Exception{
|
|
||||||
loadStartingPanel(primaryStage);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) throws InterruptedException {
|
|
||||||
launch(args);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -10,7 +10,7 @@
|
||||||
<?import javafx.scene.control.Button?>
|
<?import javafx.scene.control.Button?>
|
||||||
<?import javafx.scene.control.Label?>
|
<?import javafx.scene.control.Label?>
|
||||||
|
|
||||||
<GridPane alignment="center" hgap="10" vgap="10" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="splash_screen_on_boot.Controller">
|
<GridPane alignment="center" hgap="10" vgap="10" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="splash_screen_on_boot.java.SplashScreenOnBootController">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints />
|
<ColumnConstraints />
|
||||||
<ColumnConstraints />
|
<ColumnConstraints />
|
||||||
|
@ -57,7 +57,7 @@
|
||||||
<center>
|
<center>
|
||||||
<ImageView fx:id="LoadingGif" BorderPane.alignment="CENTER">
|
<ImageView fx:id="LoadingGif" BorderPane.alignment="CENTER">
|
||||||
<image>
|
<image>
|
||||||
<Image url="@../gifs/loadingGif.gif" />
|
<Image url="@../../gifs/loadingGif.gif" />
|
||||||
</image>
|
</image>
|
||||||
</ImageView>
|
</ImageView>
|
||||||
</center>
|
</center>
|
|
@ -0,0 +1,18 @@
|
||||||
|
package splash_screen_on_boot.java;
|
||||||
|
|
||||||
|
import javafx.application.Application;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
public class Main extends Application {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start(Stage primaryStage) throws Exception{
|
||||||
|
new SplashScreenOnBootController(primaryStage);
|
||||||
|
primaryStage.setTitle("Meerkat");
|
||||||
|
primaryStage.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws InterruptedException {
|
||||||
|
launch(args);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
package splash_screen_on_boot.java;
|
||||||
|
|
||||||
|
import javafx.concurrent.Task;
|
||||||
|
import javafx.concurrent.WorkerStateEvent;
|
||||||
|
import javafx.event.EventHandler;
|
||||||
|
import javafx.fxml.FXMLLoader;
|
||||||
|
import javafx.scene.Parent;
|
||||||
|
import javafx.scene.Scene;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SplashScreenOnBootController starts the entry point into meerkat it displays the loading
|
||||||
|
*/
|
||||||
|
public class SplashScreenOnBootController {
|
||||||
|
private static final String SPALSH_SCREEN_ON_BOOT_FXML_PATH = "../fxml/spalsh_screen_on_boot.fxml";
|
||||||
|
private static final int TWO_SECONDS_TIMEOUT_IN_MILLISECONDS = 2000;
|
||||||
|
|
||||||
|
protected Parent SplashScreenOnBootRoot;
|
||||||
|
|
||||||
|
public SplashScreenOnBootController(Stage primaryStage) throws IOException
|
||||||
|
{
|
||||||
|
SplashScreenOnBootRoot = FXMLLoader.load(getClass().getResource(SPALSH_SCREEN_ON_BOOT_FXML_PATH));
|
||||||
|
primaryStage.setScene(new Scene(SplashScreenOnBootRoot, 565, 365));
|
||||||
|
IntroSleep();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* After the splash screen displayed wait -
|
||||||
|
* two seconds and than continue to StartUploadingToBulletinBoard
|
||||||
|
*/
|
||||||
|
private void IntroSleep()
|
||||||
|
{
|
||||||
|
Task<Void> sleeper = new Task<Void>() {
|
||||||
|
@Override
|
||||||
|
protected Void call() throws Exception {
|
||||||
|
try {
|
||||||
|
Thread.sleep(TWO_SECONDS_TIMEOUT_IN_MILLISECONDS);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
sleeper.setOnSucceeded(event -> StartUploadingToBulletinBoard());
|
||||||
|
new Thread(sleeper).start();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates instance of uploading to bulletin board and set it as the scene
|
||||||
|
*/
|
||||||
|
private void StartUploadingToBulletinBoard()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Needed for normal output fllow
|
||||||
|
*/
|
||||||
|
public SplashScreenOnBootController(){}
|
||||||
|
|
||||||
|
}
|
|
@ -11,7 +11,7 @@
|
||||||
<?import javafx.scene.control.Button?>
|
<?import javafx.scene.control.Button?>
|
||||||
<?import javafx.scene.control.Label?>
|
<?import javafx.scene.control.Label?>
|
||||||
|
|
||||||
<GridPane alignment="center" hgap="10" vgap="10" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="splash_screen_on_boot.Controller">
|
<GridPane alignment="center" hgap="10" vgap="10" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="splash_screen_on_boot.java.SplashScreenOnBootController">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints />
|
<ColumnConstraints />
|
||||||
<ColumnConstraints />
|
<ColumnConstraints />
|
||||||
|
|
Loading…
Reference in New Issue