modification des boutons dans le menu regles

This commit is contained in:
Bastien NOEL 2020-05-10 15:03:18 +02:00
parent b10e068a28
commit 94b5f1dbb7
3 changed files with 29 additions and 11 deletions

View File

@ -216,6 +216,9 @@ public class PlayersController implements Initializable{
}
@FXML
public void retour(MouseEvent me) throws IOException {
InputStream fileSound1 = getClass().getResourceAsStream("/ihm/ressources/musique/BEEP1.wav");
EffetSonore.playSoundEffect(fileSound1);
final URL fxmlURL = getClass().getResource("/ihm/ressources/Menu.fxml");
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE);

View File

@ -12,11 +12,11 @@ import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
public class ReglesControlleur implements Initializable {
@ -25,6 +25,10 @@ public class ReglesControlleur implements Initializable {
private AnchorPane rootPane;
@FXML
private ImageView imageRegles;
@FXML
private Button precedent;
@FXML
private Button suivant;
private int index = 1;
@ -34,6 +38,8 @@ public class ReglesControlleur implements Initializable {
InputStream input = getClass().getResourceAsStream("/ihm/ressources/img/Regle1.PNG");
Image image = new Image(input);
imageRegles.setImage(image);
suivant.setVisible(true);
precedent.setVisible(false);
}
@ -41,14 +47,18 @@ public class ReglesControlleur implements Initializable {
public void pageSuivante(MouseEvent mouseEvent) throws IOException {
if (index < 4) {
if (index == 3) {
suivant.setVisible(false);
} else {
suivant.setVisible(true);
}
precedent.setVisible(true);
index++;
InputStream fileSound1 = getClass().getResourceAsStream("/ihm/ressources/musique/BEEP1.wav");
EffetSonore.playSoundEffect(fileSound1);
System.out.println("Page suivante");
} else {
InputStream fileSound2 = getClass().getResourceAsStream("/ihm/ressources/musique/BeepError.wav");
EffetSonore.playSoundEffect(fileSound2);
System.out.println("C'est la dernière page!");
}
InputStream input = getClass().getResourceAsStream("/ihm/ressources/img/Regle" + index + ".PNG");
@ -61,14 +71,19 @@ public class ReglesControlleur implements Initializable {
public void pagePrecedente(MouseEvent mouseEvent) throws IOException {
if (index > 1) {
if (index == 2) {
precedent.setVisible(false);
} else {
precedent.setVisible(true);
}
index--;
suivant.setVisible(true);
InputStream fileSound1 = getClass().getResourceAsStream("/ihm/ressources/musique/BEEP1.wav");
EffetSonore.playSoundEffect(fileSound1);
System.out.println("Page précédente");
} else {
InputStream fileSound2 = getClass().getResourceAsStream("/ihm/ressources/musique/BeepError.wav");
EffetSonore.playSoundEffect(fileSound2);
System.out.println("C'est la première page!");
}
InputStream input = getClass().getResourceAsStream("/ihm/ressources/img/Regle" + index + ".PNG");

View File

@ -19,7 +19,7 @@
</ImageView>
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
<children>
<Button layoutX="519.0" layoutY="31.0" mnemonicParsing="false" onMouseClicked="#pagePrecedente" prefHeight="59.0" prefWidth="225.0" styleClass="bouton" text="Page précédente">
<Button fx:id="precedent" layoutX="519.0" layoutY="31.0" mnemonicParsing="false" onMouseClicked="#pagePrecedente" prefHeight="59.0" prefWidth="225.0" styleClass="bouton" text="Page précédente">
<font>
<Font size="24.0" />
</font>
@ -35,7 +35,7 @@
<Insets left="20.0" right="20.0" />
</HBox.margin>
</Button>
<Button mnemonicParsing="false" onMouseClicked="#pageSuivante" prefHeight="59.0" prefWidth="195.0" styleClass="bouton" text="Page suivante">
<Button fx:id="suivant" mnemonicParsing="false" onMouseClicked="#pageSuivante" prefHeight="59.0" prefWidth="195.0" styleClass="bouton" text="Page suivante">
<font>
<Font size="24.0" />
</font>