Message in eine eigene Datei
This commit is contained in:
parent
6f61fbeebe
commit
1f2d46acdf
2 changed files with 30 additions and 24 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
30
src/client/Message.java
Normal file
30
src/client/Message.java
Normal file
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue