Regler si le nom est vide (ne contient que des espaces égalements)
This commit is contained in:
parent
bdd1311851
commit
462b04b54e
@ -10,6 +10,7 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import ihm.Couple;
|
||||
import ihm.EffetSonore;
|
||||
@ -147,6 +148,7 @@ public class PlayersController implements Initializable{
|
||||
for (TextField tf : txt) {
|
||||
tf.setEditable(false);
|
||||
tf.setStyle("-fx-background-color: silver;");
|
||||
|
||||
}
|
||||
|
||||
int j=0;
|
||||
@ -164,7 +166,7 @@ public class PlayersController implements Initializable{
|
||||
public void commencerJeux(MouseEvent mouseEvent) throws IOException{
|
||||
if (nbJoueursH + nbJoueursV >= 4) {
|
||||
|
||||
if(textVide()==false && memeNom()==false) {
|
||||
if(textVide()==false && memeNom()==false && nomAutorise()==true) {
|
||||
|
||||
//ajout des joueurs finalement selectionner
|
||||
int i = 0;
|
||||
@ -254,7 +256,7 @@ public class PlayersController implements Initializable{
|
||||
nbJoueursH++;
|
||||
}
|
||||
|
||||
if (nbJoueursH + nbJoueursV >= 4) {
|
||||
if (nbJoueursH + nbJoueursV >= 4 && memeNom()==false && textVide()==false && nomAutorise()==true) {
|
||||
btnCommencer.setStyle("-fx-background-color: #1d1d1d; -fx-text-fill: #d8d8d8;");
|
||||
}
|
||||
}
|
||||
@ -333,6 +335,23 @@ public class PlayersController implements Initializable{
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@FXML
|
||||
public void couleurBtnCommencerJeu() {
|
||||
|
||||
|
||||
|
||||
|
||||
if (nbJoueursH + nbJoueursV >= 4 && memeNom()==false && textVide()==false && nomAutorise()==true) {
|
||||
btnCommencer.setStyle("-fx-background-color: #1d1d1d; -fx-text-fill: #d8d8d8;");
|
||||
}
|
||||
else
|
||||
{
|
||||
btnCommencer.setStyle("-fx-background-color: gray; -fx-text-fill: black;");
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public boolean memeNom() {
|
||||
|
||||
@ -356,6 +375,19 @@ public class PlayersController implements Initializable{
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public boolean nomAutorise() {
|
||||
|
||||
int i=0;
|
||||
while(i<txt.size()) {
|
||||
if(txt.get(i).isEditable() && txt.get(i).getText().isBlank()) {
|
||||
return false;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
@FXML
|
||||
public void retour(MouseEvent me) throws IOException {
|
||||
InputStream fileSound1 = getClass().getResourceAsStream("/ihm/ressources/musique/BEEP1.wav");
|
||||
|
@ -42,7 +42,7 @@
|
||||
</HBox>
|
||||
<HBox fx:id="hb8" alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
||||
<children>
|
||||
<TextField prefHeight="51.0" prefWidth="149.0">
|
||||
<TextField onKeyPressed="#couleurBtnCommencerJeu" onKeyReleased="#couleurBtnCommencerJeu" prefHeight="51.0" prefWidth="149.0">
|
||||
<font>
|
||||
<Font size="24.0" />
|
||||
</font>
|
||||
@ -90,7 +90,7 @@
|
||||
</HBox>
|
||||
<HBox fx:id="hb7" alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
||||
<children>
|
||||
<TextField prefHeight="51.0" prefWidth="149.0">
|
||||
<TextField onKeyPressed="#couleurBtnCommencerJeu" onKeyReleased="#couleurBtnCommencerJeu" prefHeight="51.0" prefWidth="149.0">
|
||||
<font>
|
||||
<Font size="24.0" />
|
||||
</font>
|
||||
@ -146,7 +146,7 @@
|
||||
</HBox>
|
||||
<HBox fx:id="hb4" alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
||||
<children>
|
||||
<TextField prefHeight="51.0" prefWidth="149.0">
|
||||
<TextField onKeyPressed="#couleurBtnCommencerJeu" onKeyReleased="#couleurBtnCommencerJeu" prefHeight="51.0" prefWidth="149.0">
|
||||
<font>
|
||||
<Font size="24.0" />
|
||||
</font>
|
||||
@ -194,7 +194,7 @@
|
||||
</HBox>
|
||||
<HBox fx:id="hb3" alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
||||
<children>
|
||||
<TextField prefHeight="51.0" prefWidth="149.0">
|
||||
<TextField onKeyPressed="#couleurBtnCommencerJeu" onKeyReleased="#couleurBtnCommencerJeu" prefHeight="51.0" prefWidth="149.0">
|
||||
<font>
|
||||
<Font size="24.0" />
|
||||
</font>
|
||||
@ -268,7 +268,7 @@
|
||||
<children>
|
||||
<HBox fx:id="hb6" alignment="CENTER" prefWidth="754.0" rotate="180.0">
|
||||
<children>
|
||||
<TextField>
|
||||
<TextField onKeyPressed="#couleurBtnCommencerJeu" onKeyReleased="#couleurBtnCommencerJeu">
|
||||
<font>
|
||||
<Font size="24.0" />
|
||||
</font>
|
||||
@ -307,7 +307,7 @@
|
||||
<children>
|
||||
<HBox fx:id="hb5" alignment="CENTER" prefHeight="55.0" prefWidth="537.0" rotate="180.0">
|
||||
<children>
|
||||
<TextField accessibleRole="PARENT">
|
||||
<TextField accessibleRole="PARENT" onKeyPressed="#couleurBtnCommencerJeu" onKeyReleased="#couleurBtnCommencerJeu">
|
||||
<font>
|
||||
<Font size="24.0" />
|
||||
</font>
|
||||
@ -376,7 +376,7 @@
|
||||
</HBox>
|
||||
<HBox fx:id="hb1" alignment="CENTER">
|
||||
<children>
|
||||
<TextField prefHeight="51.0" prefWidth="298.0">
|
||||
<TextField onKeyPressed="#couleurBtnCommencerJeu" onKeyReleased="#couleurBtnCommencerJeu" prefHeight="51.0" prefWidth="298.0">
|
||||
<font>
|
||||
<Font size="24.0" />
|
||||
</font>
|
||||
@ -426,7 +426,7 @@
|
||||
</HBox>
|
||||
<HBox fx:id="hb2" alignment="CENTER" prefHeight="63.0" prefWidth="433.0">
|
||||
<children>
|
||||
<TextField prefHeight="51.0" prefWidth="310.0">
|
||||
<TextField onKeyPressed="#couleurBtnCommencerJeu" onKeyReleased="#couleurBtnCommencerJeu" prefHeight="51.0" prefWidth="310.0">
|
||||
<font>
|
||||
<Font size="24.0" />
|
||||
</font>
|
||||
|
Loading…
x
Reference in New Issue
Block a user