M431-ShadowHunterGame/src/ihm/controller/PlayersController.java

84 lines
1.8 KiB
Java
Raw Normal View History

2020-04-17 15:51:50 +02:00
package ihm.controller;
2020-04-21 20:45:29 +02:00
2020-04-17 15:51:50 +02:00
import java.io.IOException;
import java.net.URL;
2020-04-21 20:45:29 +02:00
import java.util.ArrayList;
import java.util.HashMap;
2020-04-17 15:51:50 +02:00
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
2020-04-21 20:45:29 +02:00
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
2020-04-20 13:46:18 +02:00
import javafx.scene.control.TextField;
2020-04-21 20:45:29 +02:00
import javafx.scene.control.TextInputControl;
2020-04-17 15:51:50 +02:00
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.BorderPane;
2020-04-21 20:45:29 +02:00
import javafx.scene.layout.HBox;
2020-04-17 15:51:50 +02:00
import javafx.scene.layout.Pane;
2020-04-21 20:45:29 +02:00
import javafx.scene.layout.VBox;
2020-04-17 15:51:50 +02:00
public class PlayersController implements Initializable{
2020-04-21 20:45:29 +02:00
@FXML private BorderPane rootPane;
@FXML private TextField tf;
@FXML private VBox vb1;
@FXML private VBox vb2;
private HBox hb10;
private HBox hb11;
private HBox hb12;
private HBox hb13;
private TextField tf0;
private Button btn;
2020-04-20 14:39:19 +02:00
2020-04-17 15:51:50 +02:00
@Override
public void initialize(URL arg0, ResourceBundle arg1) {
2020-04-21 20:45:29 +02:00
for(int i=0;i<4;i++) {
hb10=(HBox) vb1.getChildren().get(i);
tf0=(TextField) hb10.getChildren().get(0);
tf0.setEditable(false);
}
for(int i=0;i<4;i++) {
hb10=(HBox) vb1.getChildren().get(i);
tf0=(TextField) hb10.getChildren().get(0);
btn=(Button) hb10.getChildren().get(1);
btn.setOnAction((e) -> {
tf0.setEditable(true);});
}
2020-04-17 15:51:50 +02:00
}
2020-04-21 20:45:29 +02:00
//liaison.put( (Button)vb11.getChildren().get(i), maListe);
2020-04-17 15:51:50 +02:00
2020-04-21 20:45:29 +02:00
//Partie2 pas prendre en compte pour le moment
2020-04-17 15:51:50 +02:00
@FXML
public void commencerJeux(MouseEvent mouseEvent) throws IOException{
System.out.println("Lancement du jeu...");
2020-04-20 13:46:18 +02:00
BorderPane pane = FXMLLoader.load(getClass().getResource("../ressources/Plateau.fxml"));
2020-04-17 15:51:50 +02:00
rootPane.getChildren().setAll(pane);
}
2020-04-20 14:39:19 +02:00
@FXML
public void ajoutJoueur(MouseEvent mouseEvent) throws IOException{
tf.setEditable(true);
}
2020-04-17 15:51:50 +02:00
}