From 7aca06c3ee4dcd28da4221ec7f904ee5fed0c237 Mon Sep 17 00:00:00 2001 From: Juuz <6596629+Juuxel@users.noreply.github.com> Date: Sun, 15 Oct 2023 14:20:36 +0300 Subject: WScrollBar: Minor javadoc and formatting fixes --- .../cottonmc/cotton/gui/widget/WScrollBar.java | 27 ++++++++++++++-------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'src') 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 ac5ddcb..d565d12 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 @@ -15,8 +15,14 @@ import io.github.cottonmc.cotton.gui.widget.data.InputResult; public class WScrollBar extends WWidget { private static final Identifier FOCUS_TEXTURE = new Identifier(LibGuiCommon.MOD_ID, "widget/scroll_bar/focus"); + + /** + * The default {@linkplain #getScrollingSpeed() scrolling speed for mouse inputs}. + * + * @since 9.0.0 + */ public static final int DEFAULT_SCROLLING_SPEED = 4; - private int scrollingSpeed = 4; + private int scrollingSpeed = DEFAULT_SCROLLING_SPEED; protected Axis axis = Axis.HORIZONTAL; protected int value; @@ -229,24 +235,25 @@ public class WScrollBar extends WWidget { } /** - * Sets the mouse scroll speed; - *
- * Default value: {@value #DEFAULT_SCROLLING_SPEED} - * @param scrollingSpeed the scroll speed + * Sets the mouse scroll speed. + * + *
By default, the scrolling speed is {@value #DEFAULT_SCROLLING_SPEED}. + * + * @param scrollingSpeed the scroll speed, must be positive * @return this scroll bar */ public WScrollBar setScrollingSpeed(int scrollingSpeed) { - if(scrollingSpeed < 0) throw new IllegalArgumentException("Negative value for scrolling speed"); - if(scrollingSpeed == 0) throw new IllegalArgumentException("Zero value for scrolling speed"); + if (scrollingSpeed < 0) throw new IllegalArgumentException("Negative value for scrolling speed"); + if (scrollingSpeed == 0) throw new IllegalArgumentException("Zero value for scrolling speed"); this.scrollingSpeed = scrollingSpeed; return this; } /** - * Gets the mouse scroll speed; - *
- * Default value: {@value #DEFAULT_SCROLLING_SPEED} + * {@return the default mouse scroll speed} + * + *
By default, the scrolling speed is {@value #DEFAULT_SCROLLING_SPEED}. */ public int getScrollingSpeed() { return scrollingSpeed; -- cgit