From 1f2d46acdfff60c76498b439ebb6fc23d5094346 Mon Sep 17 00:00:00 2001 From: BerdanInformatik123 Date: Thu, 13 May 2021 19:45:54 +0200 Subject: [PATCH] Message in eine eigene Datei --- src/client/Client1.java | 24 ------------------------ src/client/Message.java | 30 ++++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 24 deletions(-) create mode 100644 src/client/Message.java diff --git a/src/client/Client1.java b/src/client/Client1.java index 7628846..85d43a5 100644 --- a/src/client/Client1.java +++ b/src/client/Client1.java @@ -42,27 +42,3 @@ public class Client1 { } - -class Message implements Serializable { - String username; - String message; - //String date = new SimpleDateFormat("dd-MM-yyyy").format(new Date()); - LocalDateTime current = LocalDateTime.now(); - DateTimeFormatter formatter = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM); - String date = current.format(formatter); - - - public Message( String username, String message ){ - this.username = username; - this.message = message; - //this.date = date; - } - - @Override - public String toString() { - return "nickname=" + username + - ", message=" + message + - ", time=" + date; - } - -} \ No newline at end of file diff --git a/src/client/Message.java b/src/client/Message.java new file mode 100644 index 0000000..75d20c6 --- /dev/null +++ b/src/client/Message.java @@ -0,0 +1,30 @@ +package client; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.time.format.FormatStyle; + +class Message implements Serializable { + String username; + String message; + //String date = new SimpleDateFormat("dd-MM-yyyy").format(new Date()); + LocalDateTime current = LocalDateTime.now(); + DateTimeFormatter formatter = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM); + String date = current.format(formatter); + + + public Message( String username, String message ){ + this.username = username; + this.message = message; + //this.date = date; + } + + @Override + public String toString() { + return "nickname=" + username + + ", message=" + message + + ", time=" + date; + } + +} \ No newline at end of file