Browse Source

refactoring: Code lesbarer

remotes/origin/server
Paul Kattenborn 11 months ago
parent
commit
771f121d19
  1. 10
      src/main/java/ChatGUI.java

10
src/main/java/ChatGUI.java

@ -142,11 +142,13 @@ public class ChatGUI implements ActionListener {
outputTextArea.setFont(outputTextArea.getFont().deriveFont(Font.PLAIN, 20)); outputTextArea.setFont(outputTextArea.getFont().deriveFont(Font.PLAIN, 20));
} }
}
}
// add-message method with time stamp
private void addMessage(String message) { private void addMessage(String message) {
String timeStamp = new SimpleDateFormat("HH:mm:ss").format(new Date());
outputTextArea.append("[" + timeStamp + "] " + message + "\n");
outputTextArea.setCaretPosition(outputTextArea.getDocument().getLength());
String timeStamp = new SimpleDateFormat("HH:mm:ss").format(new Date());
outputTextArea.append("[" + timeStamp + "] " + message + "\n");
outputTextArea.setCaretPosition(outputTextArea.getDocument().getLength());
} }
} }
Loading…
Cancel
Save