Fixed vertical scroll bar drawing on 4K monitors

This commit is contained in:
Kai S. K. Engelbart 2019-12-17 08:17:22 +01:00
parent 396686bfdc
commit 69153005cd
3 changed files with 6 additions and 6 deletions

View File

@ -195,7 +195,6 @@ public class ChatWindow extends JFrame {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
final JList<User> selectedUserList = (JList<User>) listSelectionEvent.getSource(); final JList<User> selectedUserList = (JList<User>) listSelectionEvent.getSource();
final User user = selectedUserList.getSelectedValue(); final User user = selectedUserList.getSelectedValue();
client.setRecipient(user);
currentChat = localDB.getChats().stream().filter(chat -> chat.getRecipient().getID() == user.getID()).findFirst().get(); currentChat = localDB.getChats().stream().filter(chat -> chat.getRecipient().getID() == user.getID()).findFirst().get();

View File

@ -68,7 +68,7 @@ public class PrimaryScrollBar extends BasicScrollBarUI {
Color color; Color color;
JScrollBar sb = (JScrollBar) c; 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; if (isDragging) color = draggingColor;
else if (isThumbRollover()) color = hoverColor; else if (isThumbRollover()) color = hoverColor;
@ -76,9 +76,9 @@ public class PrimaryScrollBar extends BasicScrollBarUI {
g2.setPaint(color); g2.setPaint(color);
if (isVertical) { 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.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 { } else {
g2.fillRoundRect(r.x, r.y + 9, r.width, r.height - 10, arcSize, arcSize); g2.fillRoundRect(r.x, r.y + 9, r.width, r.height - 10, arcSize, arcSize);
g2.setPaint(Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme()).getCellColor()); g2.setPaint(Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme()).getCellColor());

View File

@ -31,6 +31,7 @@ public class PrimaryScrollPane extends JScrollPane {
getVerticalScrollBar().setBackground(theme.getCellColor()); getVerticalScrollBar().setBackground(theme.getCellColor());
getVerticalScrollBar().setUI(new PrimaryScrollBar(theme, true)); getVerticalScrollBar().setUI(new PrimaryScrollBar(theme, true));
getHorizontalScrollBar().setBackground(theme.getCellColor()); getHorizontalScrollBar().setBackground(theme.getCellColor());
getHorizontalScrollBar().setUI(new PrimaryScrollBar(theme, false)); getHorizontalScrollBar().setUI(new PrimaryScrollBar(theme, false));
} }