Skip to content

Commit

Permalink
WScrollBar: Minor javadoc and formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Juuxel committed Oct 15, 2023
1 parent 3e74a56 commit 7aca06c
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions src/main/java/io/github/cottonmc/cotton/gui/widget/WScrollBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,14 @@

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;
Expand Down Expand Up @@ -229,24 +235,25 @@ public WScrollBar setMaxValue(int max) {
}

/**
* Sets the mouse scroll speed;
* <p>
* Default value: {@value #DEFAULT_SCROLLING_SPEED}
* @param scrollingSpeed the scroll speed
* Sets the mouse scroll speed.
*
* <p>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;
* <p>
* Default value: {@value #DEFAULT_SCROLLING_SPEED}
* {@return the default mouse scroll speed}
*
* <p>By default, the scrolling speed is {@value #DEFAULT_SCROLLING_SPEED}.
*/
public int getScrollingSpeed() {
return scrollingSpeed;
Expand Down

0 comments on commit 7aca06c

Please sign in to comment.