diff --git a/src/GUI/ChatScreen.java b/src/GUI/ChatScreen.java index 972ea6ec0e165b16ef3661237f19915f1f3d09e1..ead543eed4ae0c187f108bed0e33e5d2aa4f55ad 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)