@@ -330,12 +330,15 @@ public void initialize()
330330 {
331331 this .buttonCNR .setDisable (false );
332332 this .labelErrorNicknameS .setVisible (false );
333+ this .buttonCNR .setDisable (true );
334+ this .textFieldNicknameS .setStyle ("-fx-border-width: 0px; -fx-focus-color: #039ED3;" );
333335 }
334336 // nickname NOT
335337 else
336338 {
337339 this .buttonCNR .setDisable (true );
338340 this .labelErrorNicknameS .setVisible (true );
341+ this .textFieldNicknameS .setStyle ("-fx-text-box-border: red; -fx-focus-color: red;" );
339342 }
340343 }
341344 @ FXML public void increaseMinRoom (MouseEvent event )
@@ -456,27 +459,44 @@ public void initialize()
456459 this .buttonJER .setDisable (false );
457460 this .labelErrorNicknameC .setVisible (false );
458461 this .labelErrorIP .setVisible (false );
462+ // reset borders & focus (nickname)
463+ this .textFieldNicknameC .setStyle ("-fx-border-width: 0px; -fx-focus-color: #039ED3;" );
464+ // reset borders & focus (address)
465+ this .textFieldIP .setStyle ("-fx-border-width: 0px; -fx-focus-color: #039ED3;" );
459466 }
460467 // nickname OK & address NOT (nor empty)
461468 else if (this .checkNickname (this .textFieldNicknameC .getText ()) && !(checkIP (this .textFieldIP .getText ()) || this .textFieldIP .getText ().isEmpty ()))
462469 {
463470 this .buttonJER .setDisable (true );
464471 this .labelErrorNicknameC .setVisible (false );
465472 this .labelErrorIP .setVisible (true );
473+ // reset borders & focus (nickname)
474+ this .textFieldNicknameC .setStyle ("-fx-border-width: 0px; -fx-focus-color: #039ED3;" );
475+ // reset borders & focus (address)
476+ this .textFieldIP .setStyle ("-fx-text-box-border: red; -fx-focus-color: red;" );
466477 }
467478 // nickname NOT & address OK (or empty)
468479 else if (!this .checkNickname (this .textFieldNicknameC .getText ()) && (checkIP (this .textFieldIP .getText ()) || this .textFieldIP .getText ().isEmpty ()))
469480 {
470481 this .buttonJER .setDisable (true );
471482 this .labelErrorNicknameC .setVisible (true );
472483 this .labelErrorIP .setVisible (false );
484+ // red borders & focus (nickname)
485+ this .textFieldNicknameC .setStyle ("-fx-text-box-border: red; -fx-focus-color: red;" );
486+ // reset borders & focus (address)
487+ this .textFieldIP .setStyle ("-fx-border-width: 0px; -fx-focus-color: #039ED3;" );
473488 }
474489 // nickname NOT & address NOT (nor empty)
475490 else
476491 {
477492 this .buttonJER .setDisable (true );
478493 this .labelErrorNicknameC .setVisible (true );
479494 this .labelErrorIP .setVisible (true );
495+ // red borders & focus (nickname)
496+ this .textFieldNicknameC .setStyle ("-fx-text-box-border: red; -fx-focus-color: red;" );
497+ // red borders & focus (address)
498+ this .textFieldIP .setStyle ("-fx-text-box-border: red; -fx-focus-color: red;" );
499+
480500 }
481501 }
482502 @ FXML public void joinExistingRoom (ActionEvent event )
@@ -690,12 +710,12 @@ else if(!this.checkNickname(this.textFieldNicknameC.getText()) && (checkIP(this.
690710 }
691711
692712 // utilities
693- private boolean checkNickname (String text )
713+ public boolean checkNickname (String text )
694714 {
695715 // if OK return true
696716 return PATTERN_NICKNAME .matcher (text ).matches () ? true : false ;
697717 }
698- private boolean checkIP (String text )
718+ public boolean checkIP (String text )
699719 {
700720 // if OK return true
701721 return PATTERN_IP .matcher (text ).matches () ? true : false ;
0 commit comments