changement qui marche
This commit is contained in:
parent
6e985dc7f3
commit
2f99644369
@ -1,25 +0,0 @@
|
|||||||
package ihm;
|
|
||||||
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.net.URL;
|
|
||||||
|
|
||||||
import javafx.fxml.FXMLLoader;
|
|
||||||
import javafx.scene.layout.Pane;
|
|
||||||
|
|
||||||
public class FxmlLoader {
|
|
||||||
private Pane view;
|
|
||||||
|
|
||||||
public Pane getPage(String fileName) {
|
|
||||||
try {
|
|
||||||
URL fileUrl = Main.class.getResource("ressources/" + fileName + ".fxml");
|
|
||||||
if (fileUrl == null) {
|
|
||||||
throw new FileNotFoundException("Fil fxml pas trouvé");
|
|
||||||
}
|
|
||||||
|
|
||||||
view = new FXMLLoader().load(fileUrl);
|
|
||||||
}catch (Exception e) {
|
|
||||||
System.out.println("Pas de file" + fileName);
|
|
||||||
}
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,22 +1,33 @@
|
|||||||
package ihm.controller;
|
package ihm.controller;
|
||||||
|
|
||||||
import ihm.FxmlLoader;
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.Scene;
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.scene.control.Label;
|
import javafx.fxml.Initializable;
|
||||||
import javafx.scene.input.MouseEvent;
|
import javafx.scene.input.MouseEvent;
|
||||||
|
import javafx.scene.layout.BorderPane;
|
||||||
import javafx.scene.layout.Pane;
|
import javafx.scene.layout.Pane;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
public class MenuController {
|
public class MenuController implements Initializable{
|
||||||
private Stage window;
|
@FXML
|
||||||
|
private Pane rootPane;
|
||||||
|
|
||||||
public void commencerPartie(MouseEvent mouseEvent) {
|
@Override
|
||||||
|
public void initialize(URL arg0, ResourceBundle arg1) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void commencerPartie(MouseEvent mouseEvent) throws IOException{
|
||||||
System.out.println("Bonjouuuuur!");
|
System.out.println("Bonjouuuuur!");
|
||||||
FxmlLoader object = new FxmlLoader();
|
BorderPane pane = FXMLLoader.load(getClass().getResource("../ressources/Choix_joueur.fxml"));
|
||||||
Pane view = object.getPage("Choix_joueur");
|
System.out.println(rootPane);
|
||||||
Scene scene = new Scene(view);
|
rootPane.getChildren().setAll(pane);
|
||||||
window.setScene(scene);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void afficherRegle(MouseEvent mouseEvent) {
|
public void afficherRegle(MouseEvent mouseEvent) {
|
||||||
|
@ -5,8 +5,7 @@
|
|||||||
<?import javafx.scene.layout.Pane?>
|
<?import javafx.scene.layout.Pane?>
|
||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
|
|
||||||
|
<Pane id="rootPane" fx:id="rootPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" styleClass="background" stylesheets="@style/menu.css" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ihm.controller.MenuController">
|
||||||
<Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" styleClass="background" stylesheets="@style/menu.css" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ihm.controller.MenuController">
|
|
||||||
<children>
|
<children>
|
||||||
<Label layoutX="126.0" layoutY="46.0" styleClass="titre" text="Shadow Hunters">
|
<Label layoutX="126.0" layoutY="46.0" styleClass="titre" text="Shadow Hunters">
|
||||||
<font>
|
<font>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user