1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
| package game;
import dao.DAO;
import dao.DAOFactory;
import javafx.geometry.Insets;
import javafx.scene.Parent;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.RadioButton;
import javafx.scene.control.TextField;
import javafx.scene.control.ToggleGroup;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.VBox;
import pojo.Questions;
/**
*
* @author romain boyrie
*/
public final class Admin extends Parent {
VBox initiatedAdm;
public Admin() {
}
public BorderPane initAdm() {
DAO<Questions> questionsDao = DAOFactory.getQuestionsDAO();
BorderPane mainPane = new BorderPane();
VBox modifLvlPane = new VBox();
VBox AddLvlPane = new VBox();
GridPane topPane = new GridPane();
topPane.setHgap(20);
topPane.setVgap(5);
topPane.setPadding(new Insets(50));
topPane.setMinWidth(1000);
// topPane.setGridLinesVisible(true);
GridPane bottomPane = new GridPane();
bottomPane.setHgap(20);
bottomPane.setVgap(5);
bottomPane.setPadding(new Insets(50));
bottomPane.setMinWidth(1000);
// bottomPane.setGridLinesVisible(true);
Label lblModifQuestion = new Label("Modifier une question");
lblModifQuestion.setStyle("-fx-font: 24 arial;");
Label lblModifChoixQuestion = new Label("Choix : ");
lblModifChoixQuestion.setStyle("-fx-font: 24 arial;");
Label lblAddQuestion = new Label("Ajouter une question");
lblAddQuestion.setStyle("-fx-font: 24 arial;");
Label lblQuestionModif = new Label("Question :");
lblQuestionModif.setStyle("-fx-font: 24 arial;");
Label lblReponseModif = new Label("Reponse :");
lblReponseModif.setStyle("-fx-font: 24 arial;");
Label lblQuestionAdd = new Label("Question :");
lblQuestionAdd.setStyle("-fx-font: 24 arial;");
Label lblReponseAdd = new Label("Reponse :");
lblReponseAdd.setStyle("-fx-font: 24 arial;");
Label lblLevelModif = new Label("Choix niveau :");
lblLevelModif.setStyle("-fx-font: 24 arial;");
Label lblLevelAdd = new Label("Choix niveau :");
lblLevelAdd.setStyle("-fx-font: 24 arial;");
/*
Alimentation de la ComboBox
*/
ComboBox<Questions> cbQuestions = new ComboBox();
for (Integer i = 1; i <= questionsDao.count(); i++) {
cbQuestions.getItems().add(questionsDao.find(i));
}
TextField tbModifQuestion = new TextField();
TextField tbModifReponse = new TextField();
TextField tbAddQuestion = new TextField();
TextField tbAddReponse = new TextField();
Button btnValider = new Button("Modifier");
btnValider.setPrefSize(100, 50);
Button btnDelet = new Button("Supprimer");
btnDelet.setPrefSize(100, 50);
Button btnAdd = new Button("Ajouter");
btnAdd.setPrefSize(100, 50);
final ToggleGroup rbGroupModifLvl = new ToggleGroup();
RadioButton rbEasyLevelModif = new RadioButton("Niveau Facile");
RadioButton rbDifficultLevelModif = new RadioButton("Niveau Difficile");
rbDifficultLevelModif.setStyle("-fx-font: 20 arial;");
rbEasyLevelModif.setStyle("-fx-font: 20 arial;");
rbEasyLevelModif.setToggleGroup(rbGroupModifLvl);
rbDifficultLevelModif.setToggleGroup(rbGroupModifLvl);
modifLvlPane.getChildren().addAll(rbEasyLevelModif,rbDifficultLevelModif);
final ToggleGroup rbGroupAddLvl = new ToggleGroup();
RadioButton rbEasyLevelAdd = new RadioButton("Niveau Facile");
RadioButton rbDifficultLevelAdd = new RadioButton("Niveau Difficile");
rbDifficultLevelAdd.setStyle("-fx-font: 20 arial;");
rbEasyLevelAdd.setStyle("-fx-font: 20 arial;");
rbEasyLevelAdd.setToggleGroup(rbGroupAddLvl);
rbDifficultLevelAdd.setToggleGroup(rbGroupAddLvl);
AddLvlPane.getChildren().addAll(rbEasyLevelAdd,rbDifficultLevelAdd);
topPane.setConstraints(lblModifQuestion, 0,0);
topPane.setConstraints(lblModifChoixQuestion, 0,1);
topPane.setConstraints(lblQuestionModif, 0,2);
topPane.setConstraints(lblReponseModif, 0,3);
topPane.setConstraints(cbQuestions, 1,1);
topPane.setConstraints(tbModifQuestion, 1,2);
topPane.setConstraints(tbModifReponse, 1,3);
topPane.setConstraints(modifLvlPane, 2,3);
topPane.setConstraints(btnValider, 3,2);
topPane.setConstraints(btnDelet, 3,3);
topPane.getChildren().add(lblModifQuestion);
topPane.getChildren().add(lblModifChoixQuestion);
topPane.getChildren().add(lblQuestionModif);
topPane.getChildren().add(lblReponseModif);
topPane.getChildren().add(cbQuestions);
topPane.getChildren().add(tbModifQuestion);
topPane.getChildren().add(tbModifReponse);
topPane.getChildren().add(modifLvlPane);
topPane.getChildren().add(btnValider);
topPane.getChildren().add(btnDelet);
bottomPane.setConstraints(lblAddQuestion, 0,0);
bottomPane.setConstraints(lblQuestionAdd, 0,2);
bottomPane.setConstraints(lblReponseAdd, 0,3);
bottomPane.setConstraints(tbAddQuestion, 1,2);
bottomPane.setConstraints(tbAddReponse, 1,3);
bottomPane.setConstraints(AddLvlPane, 2,3);
bottomPane.setConstraints(btnAdd, 3,3);
bottomPane.getChildren().add(lblAddQuestion);
bottomPane.getChildren().add(lblQuestionAdd);
bottomPane.getChildren().add(lblReponseAdd);
bottomPane.getChildren().add(tbAddQuestion);
bottomPane.getChildren().add(tbAddReponse);
bottomPane.getChildren().add(AddLvlPane);
bottomPane.getChildren().add(btnAdd);
mainPane.setTop(topPane);
mainPane.setBottom(bottomPane);
return mainPane;
}
} |
Partager