diff --git a/src/main/java/ChatGUI.java b/src/main/java/ChatGUI.java index d8453fc..2c9f5bb 100644 --- a/src/main/java/ChatGUI.java +++ b/src/main/java/ChatGUI.java @@ -136,7 +136,9 @@ public class ChatGUI implements ActionListener { if (e.getSource() == inputTextField || e.getSource() == sendButton) { String inputText = inputTextField.getText(); inputTextField.setText(""); + if (!inputText.isEmpty()) { addMessage(inputText); + } } if (e.getSource() == red) { outputTextArea.setForeground(Color.RED); @@ -161,7 +163,9 @@ public class ChatGUI implements ActionListener { String message = inputTextField.getText(); inputTextField.setText(""); addMessage(message); + if(!message.isEmpty()) { sendPopupMessage(message); + } } }