aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WListPanel.java6
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WScrollBar.java2
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<D, W extends WWidget> 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<D, W extends WWidget> 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();
}