Class WSlider
java.lang.Object
io.github.cottonmc.cotton.gui.widget.WWidget
io.github.cottonmc.cotton.gui.widget.WAbstractSlider
io.github.cottonmc.cotton.gui.widget.WSlider
A simple slider widget that can be used to select int values.
- See Also:
for supported listeners
-
Nested Class Summary
Nested classes/interfaces inherited from class io.github.cottonmc.cotton.gui.widget.WAbstractSlider
WAbstractSlider.Direction -
Field Summary
FieldsFields inherited from class io.github.cottonmc.cotton.gui.widget.WAbstractSlider
axis, coordToValueRatio, direction, dragging, max, min, value, valueToCoordRatio -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable BackgroundPainterprotected intprotected booleanisMouseInsideBounds(int x, int y)Checks if the mouse cursor is close enough to the slider that the user can start dragging.voidpaint(MatrixStack matrices, int x, int y, int mouseX, int mouseY)Paints this widget.voidsetBackgroundPainter(@Nullable BackgroundPainter backgroundPainter)Methods inherited from class io.github.cottonmc.cotton.gui.widget.WAbstractSlider
canFocus, canResize, getAxis, getDirection, getDraggingFinishedListener, getMaxValue, getMinValue, getValue, getValueChangeListener, isDecreasingKey, isDragging, isIncreasingKey, onClick, onKeyPressed, onKeyReleased, onMouseDown, onMouseDrag, onMouseScroll, onMouseUp, onValueChanged, setDirection, setDraggingFinishedListener, setMaxValue, setMinValue, setSize, setValue, setValue, setValueChangeListener, tickMethods inherited from class io.github.cottonmc.cotton.gui.widget.WWidget
addPainters, addTooltip, createPeers, cycleFocus, getAbsoluteX, getAbsoluteY, getHeight, getHost, getParent, getWidth, getX, getY, hit, isActivationKey, isFocused, isWithinBounds, onCharTyped, onFocusGained, onFocusLost, onHidden, onMouseMove, onShown, releaseFocus, renderTooltip, requestFocus, setHost, setLocation, setParent, validate
-
Field Details
-
TRACK_WIDTH
public static final int TRACK_WIDTH- See Also:
- Constant Field Values
-
THUMB_SIZE
public static final int THUMB_SIZE- See Also:
- Constant Field Values
-
LIGHT_TEXTURE
-
DARK_TEXTURE
-
-
Constructor Details
-
WSlider
-
-
Method Details
-
getThumbWidth
protected int getThumbWidth()- Specified by:
getThumbWidthin classWAbstractSlider- Returns:
- the thumb size along the slider axis
-
isMouseInsideBounds
protected boolean isMouseInsideBounds(int x, int y)Description copied from class:WAbstractSliderChecks if the mouse cursor is close enough to the slider that the user can start dragging.- Specified by:
isMouseInsideBoundsin classWAbstractSlider- Parameters:
x- the mouse x positiony- the mouse y position- Returns:
- if the cursor is inside dragging bounds
-
paint
Description copied from class:WWidgetPaints this widget. -
getBackgroundPainter
-
setBackgroundPainter
@Environment(CLIENT) public void setBackgroundPainter(@Nullable @Nullable BackgroundPainter backgroundPainter)
-