création de la classe popup
This commit is contained in:
parent
a594666fa5
commit
e829dc7de6
24
src/ihm/PopUp.java
Normal file
24
src/ihm/PopUp.java
Normal file
@ -0,0 +1,24 @@
|
||||
package ihm;
|
||||
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.stage.Modality;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class PopUp {
|
||||
private Scene scene;
|
||||
private Stage popupwindow;
|
||||
|
||||
public PopUp (Pane p, String titre) {
|
||||
popupwindow = new Stage();
|
||||
popupwindow.initModality(Modality.APPLICATION_MODAL);
|
||||
popupwindow.setTitle(titre);
|
||||
|
||||
scene = new Scene(p);
|
||||
}
|
||||
|
||||
public void display() {
|
||||
popupwindow.setScene(scene);
|
||||
popupwindow.showAndWait();
|
||||
}
|
||||
}
|
36
src/ihm/controller/PlateauController.java
Normal file
36
src/ihm/controller/PlateauController.java
Normal file
@ -0,0 +1,36 @@
|
||||
package ihm.controller;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import ihm.PopUp;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.scene.control.Alert.AlertType;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.scene.layout.Pane;
|
||||
|
||||
public class PlateauController implements Initializable{
|
||||
|
||||
@Override
|
||||
public void initialize(URL arg0, ResourceBundle arg1) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Affiche aux yeux de tous la carte personnage du joueur
|
||||
*
|
||||
* @param mouseEvent : clique sur le bouton
|
||||
* @throws IOException
|
||||
*/
|
||||
public void seReveler(MouseEvent mouseEvent) throws IOException {
|
||||
System.out.println("Le joueur ... se revèle");
|
||||
Pane pane = FXMLLoader.load(getClass().getResource("../ressources/Reveler_son_identite.fxml"));
|
||||
PopUp popup = new PopUp(pane, "reveler son identité");
|
||||
popup.display();
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@ import java.util.ResourceBundle;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.scene.layout.Pane;
|
||||
@ -24,7 +25,7 @@ public class PlayersController implements Initializable{
|
||||
@FXML
|
||||
public void commencerJeux(MouseEvent mouseEvent) throws IOException{
|
||||
System.out.println("Lancement du jeu...");
|
||||
Pane pane = FXMLLoader.load(getClass().getResource("../ressources/Plateau.fxml"));
|
||||
BorderPane pane = FXMLLoader.load(getClass().getResource("../ressources/Plateau.fxml"));
|
||||
rootPane.getChildren().setAll(pane);
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@
|
||||
<Font size="36.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label styleClass="titre" stylesheets="@style/menu.css" text="Cochez la checkbox pour que le joueur soit un joueur virtuel">
|
||||
<Label styleClass="titre" stylesheets="@style/menu.css" text="Cochez la case pour que le joueur soit un joueur virtuel">
|
||||
<font>
|
||||
<Font size="36.0" />
|
||||
</font></Label>
|
||||
@ -45,7 +45,7 @@
|
||||
<children>
|
||||
<VBox alignment="CENTER_LEFT" prefHeight="533.0" prefWidth="1142.0">
|
||||
<children>
|
||||
<TextField>
|
||||
<TextField fx:id="tfJ1">
|
||||
<font>
|
||||
<Font size="24.0" />
|
||||
</font></TextField>
|
||||
|
@ -9,7 +9,7 @@
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.shape.Circle?>
|
||||
|
||||
<BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="1280.0" styleClass="background" stylesheets="@style/plateau.css" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="1280.0" styleClass="background" stylesheets="@style/plateau.css" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ihm.controller.PlateauController">
|
||||
<top>
|
||||
<HBox alignment="CENTER" prefHeight="149.0" prefWidth="1280.0" BorderPane.alignment="CENTER">
|
||||
<children>
|
||||
@ -21,7 +21,7 @@
|
||||
<HBox alignment="CENTER" prefHeight="46.0" prefWidth="212.0">
|
||||
<children>
|
||||
<Button mnemonicParsing="false" styleClass="bouton" stylesheets="@style/plateau.css" text="Carte personnage" />
|
||||
<Button mnemonicParsing="false" styleClass="bouton" stylesheets="@style/plateau.css" text="Se révéler">
|
||||
<Button mnemonicParsing="false" onMouseClicked="#seReveler" styleClass="bouton" stylesheets="@style/plateau.css" text="Se révéler">
|
||||
<HBox.margin>
|
||||
<Insets left="5.0" />
|
||||
</HBox.margin>
|
||||
@ -56,7 +56,7 @@
|
||||
<HBox alignment="CENTER" prefHeight="46.0" prefWidth="212.0">
|
||||
<children>
|
||||
<Button mnemonicParsing="false" styleClass="bouton" stylesheets="@style/plateau.css" text="Carte personnage" />
|
||||
<Button mnemonicParsing="false" styleClass="bouton" stylesheets="@style/plateau.css" text="Se révéler">
|
||||
<Button mnemonicParsing="false" onMouseClicked="#seReveler" styleClass="bouton" stylesheets="@style/plateau.css" text="Se révéler">
|
||||
<HBox.margin>
|
||||
<Insets left="5.0" />
|
||||
</HBox.margin>
|
||||
@ -97,7 +97,7 @@
|
||||
<HBox alignment="CENTER" prefHeight="44.0" prefWidth="274.0">
|
||||
<children>
|
||||
<Button mnemonicParsing="false" styleClass="bouton" stylesheets="@style/plateau.css" text="Carte personnage" />
|
||||
<Button mnemonicParsing="false" styleClass="bouton" stylesheets="@style/plateau.css" text="Se reveler">
|
||||
<Button mnemonicParsing="false" onMouseClicked="#seReveler" styleClass="bouton" stylesheets="@style/plateau.css" text="Se reveler">
|
||||
<HBox.margin>
|
||||
<Insets left="5.0" />
|
||||
</HBox.margin>
|
||||
@ -131,7 +131,7 @@
|
||||
<HBox alignment="CENTER" prefHeight="44.0" prefWidth="274.0">
|
||||
<children>
|
||||
<Button mnemonicParsing="false" styleClass="bouton" stylesheets="@style/plateau.css" text="Carte personnage" />
|
||||
<Button mnemonicParsing="false" styleClass="bouton" stylesheets="@style/plateau.css" text="Se reveler">
|
||||
<Button mnemonicParsing="false" onMouseClicked="#seReveler" styleClass="bouton" stylesheets="@style/plateau.css" text="Se reveler">
|
||||
<HBox.margin>
|
||||
<Insets left="5.0" />
|
||||
</HBox.margin>
|
||||
@ -171,7 +171,7 @@
|
||||
<HBox alignment="CENTER" prefHeight="53.0" prefWidth="198.0">
|
||||
<children>
|
||||
<Button mnemonicParsing="false" styleClass="bouton" stylesheets="@style/plateau.css" text="Carte perssonage" />
|
||||
<Button mnemonicParsing="false" styleClass="bouton" stylesheets="@style/plateau.css" text="Se révéler">
|
||||
<Button mnemonicParsing="false" onMouseClicked="#seReveler" styleClass="bouton" stylesheets="@style/plateau.css" text="Se révéler">
|
||||
<HBox.margin>
|
||||
<Insets left="5.0" />
|
||||
</HBox.margin>
|
||||
@ -205,7 +205,7 @@
|
||||
<HBox alignment="CENTER" prefHeight="53.0" prefWidth="198.0">
|
||||
<children>
|
||||
<Button mnemonicParsing="false" styleClass="bouton" stylesheets="@style/plateau.css" text="Carte perssonage" />
|
||||
<Button mnemonicParsing="false" styleClass="bouton" stylesheets="@style/plateau.css" text="Se révéler">
|
||||
<Button mnemonicParsing="false" onMouseClicked="#seReveler" styleClass="bouton" stylesheets="@style/plateau.css" text="Se révéler">
|
||||
<HBox.margin>
|
||||
<Insets left="5.0" />
|
||||
</HBox.margin>
|
||||
@ -245,7 +245,7 @@
|
||||
<HBox alignment="CENTER" prefHeight="39.0" prefWidth="214.0">
|
||||
<children>
|
||||
<Button mnemonicParsing="false" styleClass="bouton" stylesheets="@style/plateau.css" text="Carte personnage" />
|
||||
<Button mnemonicParsing="false" styleClass="bouton" stylesheets="@style/plateau.css" text="Se révéler">
|
||||
<Button mnemonicParsing="false" onMouseClicked="#seReveler" styleClass="bouton" stylesheets="@style/plateau.css" text="Se révéler">
|
||||
<HBox.margin>
|
||||
<Insets left="5.0" />
|
||||
</HBox.margin>
|
||||
@ -279,7 +279,7 @@
|
||||
<HBox alignment="CENTER" prefHeight="39.0" prefWidth="214.0">
|
||||
<children>
|
||||
<Button mnemonicParsing="false" styleClass="bouton" stylesheets="@style/plateau.css" text="Carte personnage" />
|
||||
<Button mnemonicParsing="false" styleClass="bouton" stylesheets="@style/plateau.css" text="Se révéler">
|
||||
<Button mnemonicParsing="false" onMouseClicked="#seReveler" styleClass="bouton" stylesheets="@style/plateau.css" text="Se révéler">
|
||||
<HBox.margin>
|
||||
<Insets left="5.0" />
|
||||
</HBox.margin>
|
||||
|
Loading…
x
Reference in New Issue
Block a user