From 1776e629fbc52b4a73c8eb29a571015276bdd002 Mon Sep 17 00:00:00 2001
From: Ho Dac Hai <hai.hodac@student.unimelb.edu.au>
Date: Mon, 21 Oct 2019 22:30:11 +1100
Subject: [PATCH] Replace ChatScreen.java

---
 src/GUI/ChatScreen.java | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/GUI/ChatScreen.java b/src/GUI/ChatScreen.java
index 972ea6e..ead543e 100644
--- a/src/GUI/ChatScreen.java
+++ b/src/GUI/ChatScreen.java
@@ -43,35 +43,13 @@ public class ChatScreen {
     public ChatScreen(Client client)
     {
         this.client = client;
+        exitThisRoomButton.addActionListener(actionListener);
+        sendButton.addActionListener(actionListener);
         yourNameDisplay.setText(client.getUserName());
 //        drawingPanel = new PaintGUI(client);
 //        SwingUtilities.getRootPane(sendButton).setDefaultButton(sendButton);
     }
-
-        frame.addWindowListener(new WindowAdapter()
-        {
-            @Override
-            public void windowClosing(WindowEvent arg0)
-            {
-                int answer = JOptionPane.showConfirmDialog(null,
-                        "Are you sure you want to quit the session?",
-                        "Shut down session", JOptionPane.YES_NO_OPTION);
-                System.out.println(answer);
-                if (answer == 0)
-                {
-                    System.out.println("Quitting session");
-                    try
-                    {
-                        client.getClientController().quit(client.getUserName());
-                    }
-                    catch (RemoteException e)
-                    {
-                        e.printStackTrace();
-                    }
-                    System.exit(0);
-                }
-            }
-        });
+    
 
     public JButton getSendButton() {
         return sendButton;
@@ -92,7 +70,6 @@ public class ChatScreen {
 //    }
 
 
-
     ActionListener actionListener = new ActionListener()
     {
         public void actionPerformed(ActionEvent e)
-- 
GitLab