diff --git a/src/main/java/ChatGUI.java b/src/main/java/ChatGUI.java index a521d26..93c62e7 100644 --- a/src/main/java/ChatGUI.java +++ b/src/main/java/ChatGUI.java @@ -33,7 +33,7 @@ public class ChatGUI implements ActionListener { JMenuItem green = new JMenuItem("green"); JMenuItem exit = new JMenuItem("Exit"); - + private JButton popupButton; JTextField inputTextField = new JTextField(); @@ -59,6 +59,7 @@ public class ChatGUI implements ActionListener { JMenu colors = new JMenu("font-colors"); JMenu size = new JMenu("font-size"); + // Create Pop-Up Button popupButton = new JButton("Popup-Nachricht senden"); popupButton.addActionListener(this); @@ -118,7 +119,7 @@ public class ChatGUI implements ActionListener { new ChatGUI(); } - + // add-message method with time stamp void addMessage(String message) { String timeStamp = new SimpleDateFormat("HH:mm:ss").format(new Date()); @@ -157,17 +158,15 @@ public class ChatGUI implements ActionListener { outputTextArea.setFont(outputTextArea.getFont().deriveFont(Font.PLAIN, 20)); } if (e.getSource() == popupButton) { - String message = inputTextField.getText(); - inputTextField.setText(""); - sendPopupMessage(message); - } + String message = inputTextField.getText(); + inputTextField.setText(""); + sendPopupMessage(message); + } - } - public void sendPopupMessage(String message) { - JOptionPane.showMessageDialog(gui, message); - } - + public void sendPopupMessage(String message) { + JOptionPane.showMessageDialog(gui, message); + } }