diff --git a/Application/Clavardage/src/controller/Controller.java b/Application/Clavardage/src/controller/Controller.java index c07fa23..e715511 100644 --- a/Application/Clavardage/src/controller/Controller.java +++ b/Application/Clavardage/src/controller/Controller.java @@ -170,7 +170,6 @@ public class Controller { //sc1.close(); JOptionPane.showMessageDialog(null ,"Your nickname : " + tmpPseudo + " is valid !"); - //hisView.Pseudolabel.setText("Your current username is: " + tmpPseudo); return tmpPseudo; } @@ -182,21 +181,22 @@ public class Controller { * On regarde si le pseudo est bien différent de l'ancien *

*/ - private void changePseudo() throws IOException { - String oldPseudo = this.myUser.getPseudo(); //Saves the old one for comparison + public void changePseudo() throws IOException { + String oldPseudo = this.myUser.getPseudo(); //Saves the old one for comparison - String tmpPseudo = JOptionPane.showInputDialog(null, "Enter nickname:"); // Read user input + String tmpPseudo = hisView.PseudotextField.getText(); // Read user input - while(!(this.validatePseudo(tmpPseudo)) || tmpPseudo.equals(oldPseudo)) { - tmpPseudo = JOptionPane.showInputDialog(null, "Already exist, enter another nickname :"); // Read user input - } + while(!(this.validatePseudo(tmpPseudo)) || tmpPseudo.equals(oldPseudo)) { + hisView.Pseudolabel.setText("Already exists, enter another nickname. Your current username is: " + oldPseudo); // Read user input + tmpPseudo = hisView.PseudotextField.getText(); // Read user input + } - this.myUser.setPseudo(tmpPseudo); + this.myUser.setPseudo(tmpPseudo); - JOptionPane.showMessageDialog(null ,"Your new nickname : " + tmpPseudo + " is valid !"); + JOptionPane.showMessageDialog(null ,"Your new nickname : " + tmpPseudo + " is valid !"); - this.notify_remote_users(); - } + this.notify_remote_users(); + } /** *