From ea75636e7f6975f891294c1648dc864e72997434 Mon Sep 17 00:00:00 2001 From: DieGurke <55625494+DieGurke@users.noreply.github.com> Date: Tue, 17 Mar 2020 12:11:59 +0100 Subject: [PATCH] Changed bgc of testArea and played on pref size of list and scrollPane --- src/main/java/envoy/client/ui/ChatWindow.java | 5 +++-- .../java/envoy/client/ui/renderer/MessageListRenderer.java | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/envoy/client/ui/ChatWindow.java b/src/main/java/envoy/client/ui/ChatWindow.java index eda61e4..c7f74f4 100644 --- a/src/main/java/envoy/client/ui/ChatWindow.java +++ b/src/main/java/envoy/client/ui/ChatWindow.java @@ -133,11 +133,12 @@ public class ChatWindow extends JFrame { // updates list elements when list is resized @Override public void componentResized(ComponentEvent e) { - messageList.synchronizeModel(); var prefSize = e.getComponent().getPreferredSize(); + e.getComponent().setPreferredSize(prefSize); + messageList.synchronizeModel(); messageList.setMinimumSize(new Dimension(prefSize.width, 0)); messageList.setMaximumSize(new Dimension(prefSize.width, Integer.MAX_VALUE)); - messageList.setPreferredSize(new Dimension(prefSize.width, messageList.getPreferredSize().height)); + messageList.setPreferredSize(new Dimension(prefSize.width, (int) messageList.getPreferredSize().getHeight())); } }); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); diff --git a/src/main/java/envoy/client/ui/renderer/MessageListRenderer.java b/src/main/java/envoy/client/ui/renderer/MessageListRenderer.java index 10bece5..e6622b4 100644 --- a/src/main/java/envoy/client/ui/renderer/MessageListRenderer.java +++ b/src/main/java/envoy/client/ui/renderer/MessageListRenderer.java @@ -91,7 +91,7 @@ public class MessageListRenderer implements ComponentListCellRenderer { messageTextArea.setWrapStyleWord(true); messageTextArea.setForeground(theme.getMessageTextColor()); messageTextArea.setAlignmentX(0.5f); - messageTextArea.setBackground(Color.RED); + messageTextArea.setBackground(theme.getCellColor()); messageTextArea.setEditable(false); var font = new Font("Arial", Font.PLAIN, 14); messageTextArea.setFont(font);