diff options
-rw-r--r-- | src/Client/UserInterface.java | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/Client/UserInterface.java b/src/Client/UserInterface.java index cfa03b2..594bddf 100644 --- a/src/Client/UserInterface.java +++ b/src/Client/UserInterface.java @@ -6,6 +6,8 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; import javax.swing.BoxLayout; import javax.swing.JButton; @@ -16,7 +18,7 @@ import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.JTextField; -public class UserInterface extends JFrame implements ActionListener, KeyListener +public class UserInterface extends JFrame implements ActionListener, KeyListener, WindowListener { private JTextField message; @@ -127,6 +129,8 @@ public class UserInterface extends JFrame implements ActionListener, KeyListener add(vertPanel); setVisible(true); + + this.addWindowListener(this); } int counterClick = 0; @@ -183,8 +187,34 @@ public class UserInterface extends JFrame implements ActionListener, KeyListener } } - + + public void windowClosing(WindowEvent e) + { + client.shutdown(); + System.exit(0); + } + public void keyReleased(KeyEvent arg0) {} public void keyTyped(KeyEvent arg0) {} + + @Override + public void windowActivated(WindowEvent arg0){} + + @Override + public void windowClosed(WindowEvent arg0){} + + @Override + public void windowDeactivated(WindowEvent arg0){} + + @Override + public void windowDeiconified(WindowEvent arg0){} + + + @Override + public void windowIconified(WindowEvent arg0){} + + @Override + public void windowOpened(WindowEvent arg0){} + } |