aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorJuuxel <6596629+Juuxel@users.noreply.github.com>2020-05-08 22:20:06 +0300
committerJuuxel <6596629+Juuxel@users.noreply.github.com>2020-05-08 22:20:06 +0300
commitfe0277477fbf0290429c1d593afc7bcc63db3a35 (patch)
treeb7097d54f4806430c53c064c0e813b7e2c640b52 /src/main/java
parent7e61da56c52ebfa00c2fdd036b6dc83d4c0f4e21 (diff)
downloadLibGui-fe0277477fbf0290429c1d593afc7bcc63db3a35.tar.gz
LibGui-fe0277477fbf0290429c1d593afc7bcc63db3a35.tar.bz2
LibGui-fe0277477fbf0290429c1d593afc7bcc63db3a35.zip
WScrollBar: Fix window
Diffstat (limited to 'src/main/java')
-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();
}