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;
|
||||
|
||||
import ihm.FxmlLoader;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class MenuController {
|
||||
private Stage window;
|
||||
public class MenuController implements Initializable{
|
||||
@FXML
|
||||
private Pane rootPane;
|
||||
|
||||
@Override
|
||||
public void initialize(URL arg0, ResourceBundle arg1) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void commencerPartie(MouseEvent mouseEvent) {
|
||||
@FXML
|
||||
public void commencerPartie(MouseEvent mouseEvent) throws IOException{
|
||||
System.out.println("Bonjouuuuur!");
|
||||
FxmlLoader object = new FxmlLoader();
|
||||
Pane view = object.getPage("Choix_joueur");
|
||||
Scene scene = new Scene(view);
|
||||
window.setScene(scene);
|
||||
BorderPane pane = FXMLLoader.load(getClass().getResource("../ressources/Choix_joueur.fxml"));
|
||||
System.out.println(rootPane);
|
||||
rootPane.getChildren().setAll(pane);
|
||||
}
|
||||
|
||||
public void afficherRegle(MouseEvent mouseEvent) {
|
||||
|
@ -5,8 +5,7 @@
|
||||
<?import javafx.scene.layout.Pane?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
|
||||
<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">
|
||||
<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">
|
||||
<children>
|
||||
<Label layoutX="126.0" layoutY="46.0" styleClass="titre" text="Shadow Hunters">
|
||||
<font>
|
||||
|
Loading…
x
Reference in New Issue
Block a user