From 1e3e1ffe4a7ede432bb5411e0818e77dbafd7ba8 Mon Sep 17 00:00:00 2001 From: Alena Bandarovich Date: Sat, 3 Feb 2024 20:23:33 +0100 Subject: [PATCH] add input and output areas in GUI window --- src/main/java/ChatClient.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/ChatClient.java b/src/main/java/ChatClient.java index 5c60638..00600d0 100644 --- a/src/main/java/ChatClient.java +++ b/src/main/java/ChatClient.java @@ -7,6 +7,10 @@ public class ChatClient extends JFrame { private int port; private Socket connectionToServer; + // GUI + private JTextArea outputTextArea; + private JTextField inputTextField; + public ChatClient(int port) { super("Chat"); this.port = port; @@ -18,6 +22,12 @@ public class ChatClient extends JFrame { } private void initGui() { + outputTextArea = new JTextArea(); + inputTextField = new JTextField(); + + add(outputTextArea); + add(inputTextField); + setVisible(true); setSize(800, 600); setDefaultCloseOperation(EXIT_ON_CLOSE);