From 06e09a1a0b4e5dd5ca0b7f6185dcfe01686ed963 Mon Sep 17 00:00:00 2001 From: Alena Bandarovich Date: Fri, 9 Feb 2024 19:55:31 +0100 Subject: [PATCH] Bring window to input name in front --- src/main/java/ClientHandler.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/ClientHandler.java b/src/main/java/ClientHandler.java index b30e37a..2371721 100644 --- a/src/main/java/ClientHandler.java +++ b/src/main/java/ClientHandler.java @@ -1,8 +1,7 @@ +import javax.swing.*; import java.io.*; import java.net.Socket; -import javax.swing.JOptionPane; - public class ClientHandler implements Runnable { private ChatServer chatServer; private Socket connectionToClient; @@ -15,7 +14,9 @@ public class ClientHandler implements Runnable { public ClientHandler(ChatServer chatServer, Socket connectionToClient) { this.chatServer = chatServer; this.connectionToClient = connectionToClient; - name = JOptionPane.showInputDialog("Benutzername für neuen Client vergeben"); + final JDialog dialog = new JDialog(); + dialog.setAlwaysOnTop(true); + name = JOptionPane.showInputDialog(dialog,"Benutzername für neuen Client vergeben"); new Thread(this).start();} // Start a new thread for this client handler