From 50b3994180dcb9b96eae34d2f94914e086ba3eb4 Mon Sep 17 00:00:00 2001 From: Alena Bandarovich Date: Wed, 7 Feb 2024 19:34:28 +0100 Subject: [PATCH] Close messaging window if the connection is broken --- src/main/java/ChatClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/ChatClient.java b/src/main/java/ChatClient.java index eb8fd84..f39bc2f 100644 --- a/src/main/java/ChatClient.java +++ b/src/main/java/ChatClient.java @@ -60,6 +60,7 @@ public class ChatClient extends JFrame implements KeyListener { } } catch (IOException e) { JOptionPane.showMessageDialog(null, "Verbindung zum Server \"" + address + "\" fehlgeschlagen."); + dispose(); } finally { if (null != connectionToServer) { try { @@ -80,7 +81,6 @@ public class ChatClient extends JFrame implements KeyListener { if(null != toServerWriter) { toServerWriter.close(); } - } }