From a96e99b6881fb68be2ea39bea7860156ae6ef486 Mon Sep 17 00:00:00 2001
From: E203647F <arthur.wlodarczak@univ-nantes.fr>
Date: Fri, 25 Jun 2021 09:37:04 +0200
Subject: [PATCH] =?UTF-8?q?Arthur=20:=20Correction=20du=20bug=20emp=C3=AAc?=
 =?UTF-8?q?hant=20la=20fenetre=20MenuPartie=20de=20se=20fermer?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/controleurs/ListenerBoutonCreate.java | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/controleurs/ListenerBoutonCreate.java b/src/controleurs/ListenerBoutonCreate.java
index b6050be..786eb8f 100644
--- a/src/controleurs/ListenerBoutonCreate.java
+++ b/src/controleurs/ListenerBoutonCreate.java
@@ -33,13 +33,15 @@ public class ListenerBoutonCreate implements ActionListener {
 
 
         try {
+            int gameID = (Network.initNewGame("http://37.187.38.219/api/v0", f1.getPlayerVues(), f1.getMaflotte())).getId();
+            Game JoinGame = new Game(gameID);
+            fenetre3.setGame(JoinGame);
             ArrayList  test = new ArrayList(Network.listActivePlayers("http://37.187.38.219/api/v0"));
-            JOptionPane optionPane = new JOptionPane("L'ID de votre partie est : " +  (Network.initNewGame("http://37.187.38.219/api/v0", f1.getPlayerVues(), f1.getMaflotte())).getId() + "  et ton nom est : " +f1.getPlayerVues().getName(), JOptionPane.INFORMATION_MESSAGE) ;
+            JOptionPane optionPane = new JOptionPane("L'ID de votre partie est : " +  gameID + "  et ton nom est : " +f1.getPlayerVues().getName(), JOptionPane.INFORMATION_MESSAGE) ;
             JDialog dialog = optionPane.createDialog("Message d'information");
             dialog.setAlwaysOnTop(true);
             dialog.setVisible(true);
-            Game JoinGame = new Game(f1.donneId());
-            fenetre3.setGame(JoinGame);
+            f1.dispose();
 
 
 
@@ -47,7 +49,7 @@ public class ListenerBoutonCreate implements ActionListener {
         } catch (UnirestException | UncompleteFleetException | BadCoordException | BadIdException exception) {
             exception.printStackTrace();
         }
-        f1.dispose();
+
 
     }
 }
\ No newline at end of file
-- 
GitLab