diff options
author | Aya <31237389+tal5@users.noreply.github.com> | 2023-11-13 22:19:18 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-14 00:19:18 +0200 |
commit | 9dac7f4cbd21987727813ff23612729e84796520 (patch) | |
tree | f383d7da64b328330ef5c8a908406a70a5cd9721 | |
parent | bc2fb79b4ea5db644ef4e64641239893f349f579 (diff) | |
download | LibGui-9dac7f4cbd21987727813ff23612729e84796520.tar.gz LibGui-9dac7f4cbd21987727813ff23612729e84796520.tar.bz2 LibGui-9dac7f4cbd21987727813ff23612729e84796520.zip |
Add scroll bar getters and setters to WScrollPanel (#225)
-rw-r--r-- | src/main/java/io/github/cottonmc/cotton/gui/widget/WScrollPanel.java | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WScrollPanel.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WScrollPanel.java index 620adc8..d0582af 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WScrollPanel.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WScrollPanel.java @@ -9,6 +9,8 @@ import io.github.cottonmc.cotton.gui.GuiDescription; import io.github.cottonmc.cotton.gui.widget.data.Axis; import io.github.cottonmc.cotton.gui.widget.data.InputResult; +import java.util.Objects; + /** * Similar to the JScrollPane in Swing, this widget represents a scrollable widget. * @@ -51,6 +53,27 @@ public class WScrollPanel extends WClippedPanel { } /** + * Returns this scroll panel's horizontal scroll bar. + * + * @return the horizontal scroll bar + */ + public WScrollBar getHorizontalScrollBar() { + return this.horizontalScrollBar; + } + + /** + * Sets this scroll panel's horizontal scroll bar. + * + * @param horizontalScrollBar the new horizontal scroll bar + * @return this scroll panel + * @throws NullPointerException if the horizontalScrollBar is null + */ + public WScrollPanel setHorizontalScrollBar(WScrollBar horizontalScrollBar) { + this.horizontalScrollBar = Objects.requireNonNull(horizontalScrollBar, "horizontalScrollBar"); + return this; + } + + /** * Returns whether this scroll panel has a horizontal scroll bar. * * @return true if there is a horizontal scroll bar, @@ -71,6 +94,27 @@ public class WScrollPanel extends WClippedPanel { } /** + * Returns this scroll panel's vertical scroll bar. + * + * @return the vertical scroll bar + */ + public WScrollBar getVerticalScrollBar() { + return this.verticalScrollBar; + } + + /** + * Sets this scroll panel's vertical scroll bar. + * + * @param verticalScrollBar the new vertical scroll bar + * @return this scroll panel + * @throws NullPointerException if the verticalScrollBar is null + */ + public WScrollPanel setVerticalScrollBar(WScrollBar verticalScrollBar) { + this.verticalScrollBar = Objects.requireNonNull(verticalScrollBar, "verticalScrollBar"); + return this; + } + + /** * Returns whether this scroll panel has a vertical scroll bar. * * @return true if there is a vertical scroll bar, |