idS = id + "";
setTitle("Creation de compte");
initStyle(StageStyle.DECORATED);
Insets insets = new Insets(5, 5, 5, 5);
BorderPane borderPane = new BorderPane();
GridPane gridPane = new GridPane();
gridPane.setAlignment(Pos.CENTER);
Label teamLabel = new Label("Nom de l'�quipe");
teamTextField = new TextField("");
gridPane.add(teamLabel, 0, 1);
gridPane.add(teamTextField, 1, 1);
GridPane.setMargin(teamTextField, insets);
// May be SelectionMode can be better
Label teammateLabel = new Label("Nom du coequipier");
teammateTextField = new TextField("");
gridPane.add(teammateLabel, 0, 3);
gridPane.add(teammateTextField, 1, 3);
GridPane.setMargin(teammateTextField, insets);
BorderPane.setAlignment(gridPane, Pos.CENTER);
borderPane.setCenter(gridPane);
FlowPane flow = new FlowPane();
flow.setAlignment(Pos.CENTER);
okButton = new Button("Valider");
okButton.setOnAction(new EventHandler() {
@Override
public void handle(Event arg0) {
// TODO Auto-generated method stub
try {
if (sql.getInstance().insertTeam(
CreationTeamStage.this.teamTextField.getText(),
CreationTeamStage.this.teammateTextField.getText(),
CreationTeamStage.this.idS)) {
MessageBox message = new MessageBox("Equipe Cr��",
"F�licitation, l'�quipe "
+ CreationTeamStage.this.teamTextField
.getText() + " a �t� cr�e.");
message.showDialog();
} else {
MessageBox message = new MessageBox("Echec",
"Creation Impossible");
message.showDialog();
}
} catch (SQLException e) {
MessageBox message = new MessageBox("Echec", e.getMessage());
message.showDialog();
}
}
});
okButton.setDefaultButton(true);
flow.getChildren().add(okButton);
FlowPane.setMargin(okButton, insets);
exitButton = new Button("Quitter");
exitButton.setOnAction(new EventHandler() {
@Override
public void handle(Event arg0) {
// TODO Auto-generated method stub
close();
}
});
exitButton.setCancelButton(true);
flow.getChildren().add(exitButton);
FlowPane.setMargin(exitButton, insets);
BorderPane.setAlignment(flow, Pos.CENTER);
borderPane.setBottom(flow);
Scene scene = new Scene(borderPane);
setScene(scene);
sizeToScene();
centerOnScreen();