From 69153005cd661544a39005df4c2574b9c8ebe809 Mon Sep 17 00:00:00 2001 From: kske Date: Tue, 17 Dec 2019 08:17:22 +0100 Subject: [PATCH] Fixed vertical scroll bar drawing on 4K monitors --- src/main/java/envoy/client/ui/ChatWindow.java | 1 - src/main/java/envoy/client/ui/PrimaryScrollBar.java | 6 +++--- src/main/java/envoy/client/ui/PrimaryScrollPane.java | 5 +++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/envoy/client/ui/ChatWindow.java b/src/main/java/envoy/client/ui/ChatWindow.java index 49c73df..910180c 100644 --- a/src/main/java/envoy/client/ui/ChatWindow.java +++ b/src/main/java/envoy/client/ui/ChatWindow.java @@ -195,7 +195,6 @@ public class ChatWindow extends JFrame { @SuppressWarnings("unchecked") final JList selectedUserList = (JList) listSelectionEvent.getSource(); final User user = selectedUserList.getSelectedValue(); - client.setRecipient(user); currentChat = localDB.getChats().stream().filter(chat -> chat.getRecipient().getID() == user.getID()).findFirst().get(); diff --git a/src/main/java/envoy/client/ui/PrimaryScrollBar.java b/src/main/java/envoy/client/ui/PrimaryScrollBar.java index 6853d8f..20bed6c 100644 --- a/src/main/java/envoy/client/ui/PrimaryScrollBar.java +++ b/src/main/java/envoy/client/ui/PrimaryScrollBar.java @@ -68,7 +68,7 @@ public class PrimaryScrollBar extends BasicScrollBarUI { Color color; JScrollBar sb = (JScrollBar) c; - if (!sb.isEnabled() || (isVertical && r.width > r.height) || (!isVertical && r.width < r.height)) return; + if (!sb.isEnabled()) return; if (isDragging) color = draggingColor; else if (isThumbRollover()) color = hoverColor; @@ -76,9 +76,9 @@ public class PrimaryScrollBar extends BasicScrollBarUI { g2.setPaint(color); if (isVertical) { - g2.fillRoundRect(r.x + 9, r.y, r.width - 10, r.height, arcSize, arcSize); + g2.fillRoundRect(r.x - 9, r.y, r.width, r.height, arcSize, arcSize); g2.setPaint(Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme()).getCellColor()); - g2.drawRoundRect(r.x + 9, r.y, r.width - 10, r.height, arcSize, arcSize); + g2.drawRoundRect(r.x - 9, r.y, r.width, r.height, arcSize, arcSize); } else { g2.fillRoundRect(r.x, r.y + 9, r.width, r.height - 10, arcSize, arcSize); g2.setPaint(Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme()).getCellColor()); diff --git a/src/main/java/envoy/client/ui/PrimaryScrollPane.java b/src/main/java/envoy/client/ui/PrimaryScrollPane.java index 904806a..61c348a 100644 --- a/src/main/java/envoy/client/ui/PrimaryScrollPane.java +++ b/src/main/java/envoy/client/ui/PrimaryScrollPane.java @@ -21,7 +21,7 @@ public class PrimaryScrollPane extends JScrollPane { /** * Styles the vertical and horizontal scroll bars. - * + * * @param theme * @since Envoy v0.2-alpha */ @@ -31,6 +31,7 @@ public class PrimaryScrollPane extends JScrollPane { getVerticalScrollBar().setBackground(theme.getCellColor()); getVerticalScrollBar().setUI(new PrimaryScrollBar(theme, true)); + getHorizontalScrollBar().setBackground(theme.getCellColor()); getHorizontalScrollBar().setUI(new PrimaryScrollBar(theme, false)); } @@ -45,7 +46,7 @@ public class PrimaryScrollPane extends JScrollPane { *
* When rereading messages, the chat doesn't scroll down if new messages
* are added. (Besides see first point) - * + * * @since Envoy v0.2-alpha */ public void autoscroll() {