From c117cd50ce85f55fb5b709e310877ac5f8b91e00 Mon Sep 17 00:00:00 2001 From: Paul Kattenborn Date: Fri, 9 Feb 2024 18:20:56 +0100 Subject: [PATCH] =?UTF-8?q?Pop-Up=20Button=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/ChatGUI.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/java/ChatGUI.java b/src/main/java/ChatGUI.java index 743e4f4..7ed5601 100644 --- a/src/main/java/ChatGUI.java +++ b/src/main/java/ChatGUI.java @@ -11,6 +11,7 @@ import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; +import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; @@ -30,6 +31,8 @@ public class ChatGUI implements ActionListener { JMenuItem green = new JMenuItem("green"); JMenuItem exit = new JMenuItem("Exit"); + + private JButton popupButton; JTextField inputTextField = new JTextField(); JTextArea outputTextArea = new JTextArea(); @@ -53,6 +56,8 @@ public class ChatGUI implements ActionListener { JMenu options = new JMenu("options"); JMenu colors = new JMenu("font-colors"); JMenu size = new JMenu("font-size"); + + popupButton = new JButton("Popup-Nachricht senden"); JMenu menu = new JMenu("File"); menu.add(exit); @@ -89,8 +94,9 @@ public class ChatGUI implements ActionListener { // Set up the input panel with text field and send button JPanel inputPanel = new JPanel(new BorderLayout()); + inputPanel.add(popupButton, BorderLayout.EAST); inputPanel.add(inputTextField, BorderLayout.CENTER); - inputPanel.add(sendButton, BorderLayout.EAST); + inputPanel.add(sendButton, BorderLayout.WEST); gui.add(inputPanel, BorderLayout.SOUTH); inputTextField.addActionListener(this); @@ -141,4 +147,10 @@ public class ChatGUI implements ActionListener { } } + public class NotificationManager { + + public void sendPopupMessage(String message) { + JOptionPane.showMessageDialog(gui, message); + } + } }