From e1ea0eaa7917e42a416afddffb4a3812d78643ab Mon Sep 17 00:00:00 2001 From: Paul Kattenborn Date: Fri, 9 Feb 2024 01:55:42 +0100 Subject: [PATCH] =?UTF-8?q?Logik=20f=C3=BCr=20Eingabe-Ausgabe=20hinzugef?= =?UTF-8?q?=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/ChatGUI.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/ChatGUI.java b/src/main/java/ChatGUI.java index 124332e..f6d09d7 100644 --- a/src/main/java/ChatGUI.java +++ b/src/main/java/ChatGUI.java @@ -50,6 +50,8 @@ public class ChatGUI implements ActionListener { inputTextField.setPreferredSize(new Dimension(0, 30)); gui.add(inputTextField, BorderLayout.SOUTH); + inputTextField.addActionListener(this); + // Set the size of the GUI to be a quarter of the screen size Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int quarterWidth = screenSize.width / 2; @@ -68,7 +70,12 @@ public class ChatGUI implements ActionListener { if (e.getSource() == exit) { System.exit(0); } + if (e.getSource() == inputTextField) { + String inputText = inputTextField.getText(); + outputTextArea.append(inputText + "\n"); + inputTextField.setText(""); } } +}