From fe0277477fbf0290429c1d593afc7bcc63db3a35 Mon Sep 17 00:00:00 2001 From: Juuxel <6596629+Juuxel@users.noreply.github.com> Date: Fri, 8 May 2020 22:20:06 +0300 Subject: WScrollBar: Fix window --- src/main/java/io/github/cottonmc/cotton/gui/widget/WListPanel.java | 6 ++---- src/main/java/io/github/cottonmc/cotton/gui/widget/WScrollBar.java | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WListPanel.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WListPanel.java index 1d357c0..9416f95 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WListPanel.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WListPanel.java @@ -102,9 +102,7 @@ public class WListPanel extends WClippedPanel { this.children.add(scrollBar); scrollBar.setLocation(this.width-scrollBar.getWidth(), 0); scrollBar.setSize(8, this.height); - //scrollBar.window = 6; - scrollBar.setMaxValue(data.size()); - + //super.layout(); //System.out.println("Validating"); @@ -139,7 +137,7 @@ public class WListPanel extends WClippedPanel { //Fix up the scrollbar handle and track metrics scrollBar.setWindow(cellsHigh); - //scrollBar.setMaxValue(data.size()); + scrollBar.setMaxValue(data.size()); int scrollOffset = scrollBar.getValue(); //System.out.println(scrollOffset); diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WScrollBar.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WScrollBar.java index 2010a08..ff7d5e8 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WScrollBar.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WScrollBar.java @@ -129,7 +129,7 @@ public class WScrollBar extends WAbstractSlider { } public void setMaxValue(int max) { - super.setMaxValue(max); + super.setMaxValue(max - window); checkValue(); } -- cgit