Launcher now finds and correctly sets main Scene
This commit is contained in:
parent
4e99b1e115
commit
cd7627d36d
5
pom.xml
5
pom.xml
@ -7,6 +7,11 @@
|
|||||||
<description>Projet de fin d'année de L3</description>
|
<description>Projet de fin d'année de L3</description>
|
||||||
<build>
|
<build>
|
||||||
<sourceDirectory>src</sourceDirectory>
|
<sourceDirectory>src</sourceDirectory>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/launcher/ui</directory>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
@ -9,8 +9,6 @@
|
|||||||
|
|
||||||
package launcher;
|
package launcher;
|
||||||
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
|
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
import javafx.scene.Parent;
|
import javafx.scene.Parent;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
@ -19,16 +17,19 @@ import javafx.fxml.*;
|
|||||||
|
|
||||||
public class Launcher extends Application {
|
public class Launcher extends Application {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Start method is used by Launcher as an implementation of the Application class to create a JavaFX thread to display the GUI window
|
||||||
|
*/
|
||||||
public void start(Stage primaryStage) throws Exception {
|
public void start(Stage primaryStage) throws Exception {
|
||||||
FileInputStream r_launcher = new FileInputStream("ui/launcher.fxml");
|
|
||||||
FXMLLoader floader = new FXMLLoader();
|
Parent root = FXMLLoader.load(getClass().getResource("ui/launcher.fxml"));
|
||||||
Parent root = floader.load(r_launcher);
|
|
||||||
Scene main = root.getScene();
|
Scene main = new Scene(root);
|
||||||
|
|
||||||
primaryStage.setTitle("Boulevard Combattant");
|
primaryStage.setTitle("Boulevard Combattant");
|
||||||
|
|
||||||
primaryStage.setScene(main);
|
primaryStage.setScene(main);
|
||||||
primaryStage.show();
|
primaryStage.show();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user