From 18a078475d21689f1516fdcf28cdabb91f42fbf4 Mon Sep 17 00:00:00 2001 From: kske Date: Wed, 23 Oct 2019 05:49:15 +0200 Subject: [PATCH] Added HTML formatting to message list elements --- .../java/envoy/client/ui/MessageListRenderer.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/envoy/client/ui/MessageListRenderer.java b/src/main/java/envoy/client/ui/MessageListRenderer.java index 09c3c83..ad965c4 100644 --- a/src/main/java/envoy/client/ui/MessageListRenderer.java +++ b/src/main/java/envoy/client/ui/MessageListRenderer.java @@ -1,6 +1,7 @@ package envoy.client.ui; import java.awt.Component; +import java.text.SimpleDateFormat; import javax.swing.JLabel; import javax.swing.JList; @@ -21,8 +22,7 @@ public class MessageListRenderer extends JLabel implements ListCellRenderer list, Message value, int index, - boolean isSelected, - boolean cellHasFocus) { + boolean isSelected, boolean cellHasFocus) { if (isSelected) { setBackground(list.getSelectionBackground()); setForeground(list.getSelectionForeground()); @@ -31,11 +31,13 @@ public class MessageListRenderer extends JLabel implements ListCellRenderer

%s

%s", + new SimpleDateFormat("dd.MM.yyyy hh:mm ") + .format(value.getMetaData().getDate().toGregorianCalendar().getTime()), + value.getContent().get(0).getText())); return this; }