diff --git a/src/main/java/ChatGUI.java b/src/main/java/ChatGUI.java index 2f8e4ad..a521d26 100644 --- a/src/main/java/ChatGUI.java +++ b/src/main/java/ChatGUI.java @@ -60,6 +60,7 @@ public class ChatGUI implements ActionListener { JMenu size = new JMenu("font-size"); popupButton = new JButton("Popup-Nachricht senden"); + popupButton.addActionListener(this); JMenu menu = new JMenu("File"); menu.add(exit); @@ -155,10 +156,14 @@ public class ChatGUI implements ActionListener { if (e.getSource() == large) { outputTextArea.setFont(outputTextArea.getFont().deriveFont(Font.PLAIN, 20)); } + if (e.getSource() == popupButton) { + String message = inputTextField.getText(); + inputTextField.setText(""); + sendPopupMessage(message); + } } - public class NotificationManager { public void sendPopupMessage(String message) { JOptionPane.showMessageDialog(gui, message); @@ -166,4 +171,3 @@ public class ChatGUI implements ActionListener { } -}