From 9686707419612ab0f685efc4b22ae157f6789986 Mon Sep 17 00:00:00 2001 From: Paul Kattenborn Date: Fri, 9 Feb 2024 02:00:47 +0100 Subject: [PATCH] =?UTF-8?q?Schriftfarboptionen=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/ChatGUI.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/java/ChatGUI.java b/src/main/java/ChatGUI.java index 0781edc..3651223 100644 --- a/src/main/java/ChatGUI.java +++ b/src/main/java/ChatGUI.java @@ -1,4 +1,5 @@ import java.awt.BorderLayout; +import java.awt.Color; import java.awt.Dimension; import java.awt.Toolkit; import java.awt.event.ActionEvent; @@ -50,6 +51,11 @@ public class ChatGUI implements ActionListener { colors.add(blue); colors.add(green); + red.addActionListener(this); + blue.addActionListener(this); + black.addActionListener(this); + green.addActionListener(this); + exit.addActionListener(this); bar.add(menu); @@ -86,6 +92,16 @@ public class ChatGUI implements ActionListener { String inputText = inputTextField.getText(); outputTextArea.append(inputText + "\n"); inputTextField.setText(""); + } + if (e.getSource() == red) { + outputTextArea.setForeground(Color.RED); + } + if (e.getSource() == blue) { + outputTextArea.setForeground(Color.BLUE); + }else if (e.getSource() == black) { + outputTextArea.setForeground(Color.BLACK); + } else if (e.getSource() == green) { + outputTextArea.setForeground(Color.GREEN); }