diff --git a/POO/src/main/ControleurConnexion.java b/POO/src/main/ControleurConnexion.java index 9d3affc..340deec 100644 --- a/POO/src/main/ControleurConnexion.java +++ b/POO/src/main/ControleurConnexion.java @@ -5,6 +5,7 @@ import java.awt.event.ActionListener; import java.io.IOException; import java.net.UnknownHostException; + import communication.*; public class ControleurConnexion implements ActionListener, Observer{ @@ -34,7 +35,7 @@ public class ControleurConnexion implements ActionListener, Observer{ this.comUDP = new CommunicationUDP(2408, 2409, new int[] {2209, 2309}); break; default : - this.comUDP = new CommunicationUDP(2308, 2309, new int[] {2209, 2409}); + this.comUDP = new CommunicationUDP(2408, 2409, new int[] {2209, 2309}); } } catch (IOException e) { e.printStackTrace(); @@ -105,8 +106,7 @@ public class ControleurConnexion implements ActionListener, Observer{ e1.printStackTrace(); } try { - //Ne se ferme pas ??????? - vue.dispose(); + vue.close(); new VueStandard("Standard", comUDP); } catch (IOException e1) { // TODO Auto-generated catch block diff --git a/POO/src/main/ControleurStandard.java b/POO/src/main/ControleurStandard.java index edbea7d..77cf30a 100644 --- a/POO/src/main/ControleurStandard.java +++ b/POO/src/main/ControleurStandard.java @@ -86,7 +86,7 @@ public class ControleurStandard implements ActionListener, ListSelectionListener VueStandard.userList.removeAllElements(); Utilisateur.getSelf().setPseudo(""); vue.dispose(); - new VueConnexion(0); + new VueConnexion(5); /*this.vue.toggleEnableButtonConnexion(); this.vue.toggleEnableButtonDeconnexion();*/ } catch (IOException e1) { diff --git a/POO/src/main/Vue.java b/POO/src/main/Vue.java index 9e7832d..64c6df5 100644 --- a/POO/src/main/Vue.java +++ b/POO/src/main/Vue.java @@ -10,6 +10,7 @@ public class Vue extends JFrame{ public void reduireAgent() {} - public void fermerAgent() {} - + public void close() { + this.dispose(); + } } diff --git a/POO/src/main/VueConnexion.java b/POO/src/main/VueConnexion.java index d6ec494..839a60b 100644 --- a/POO/src/main/VueConnexion.java +++ b/POO/src/main/VueConnexion.java @@ -8,7 +8,6 @@ import javax.swing.*; public class VueConnexion extends Vue { //Elements vue - private JFrame frame; private JPanel panel; private JButton boutonValider; private JTextField input; @@ -17,15 +16,15 @@ public class VueConnexion extends Vue { //Controleur ControleurConnexion controle; + //penser à enlever le numtest public VueConnexion(int numtest) { super("Connexion"); controle = new ControleurConnexion(this, numtest); //Creation fenetre - frame = new JFrame("Connexion"); - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - frame.setSize(400, 100); - frame.setLocationRelativeTo(null); + this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + this.setSize(400, 100); + this.setLocationRelativeTo(null); //Creation panel panel = new JPanel(new GridLayout(3,1)); @@ -34,13 +33,13 @@ public class VueConnexion extends Vue { ajouterElements(); //Regle le bouton par défaut - frame.getRootPane().setDefaultButton(boutonValider); + this.getRootPane().setDefaultButton(boutonValider); //Ajoute le panel a la fenetre - frame.getContentPane().add(panel, BorderLayout.CENTER); + this.getContentPane().add(panel, BorderLayout.CENTER); //Affiche la fenetre - frame.setVisible(true); + this.setVisible(true); } private void ajouterElements() {