public class WLabeledSlider extends WAbstractSlider
In addition to the standard slider listeners, labeled sliders also support "label updaters" that can update the label when the value is changed.
for more information about listeners| Modifier and Type | Class and Description |
|---|---|
static interface |
WLabeledSlider.LabelUpdater
A label updater updates the label of a slider based on the current value.
|
WAbstractSlider.Directionaxis, coordToValueRatio, direction, dragging, max, min, value, valueToCoordRatio| Constructor and Description |
|---|
WLabeledSlider(int min,
int max)
Constructs a horizontal slider with no default label.
|
WLabeledSlider(int min,
int max,
Axis axis)
Constructs a slider with no default label.
|
WLabeledSlider(int min,
int max,
Axis axis,
@Nullable net.minecraft.text.Text label)
Constructs a slider.
|
WLabeledSlider(int min,
int max,
@Nullable net.minecraft.text.Text label)
Constructs a horizontal slider.
|
| Modifier and Type | Method and Description |
|---|---|
@Nullable net.minecraft.text.Text |
getLabel()
Gets the current label of this slider.
|
HorizontalAlignment |
getLabelAlignment()
Gets the text alignment of this slider's label.
|
@Nullable WLabeledSlider.LabelUpdater |
getLabelUpdater()
Gets the
WLabeledSlider.LabelUpdater of this slider. |
protected int |
getThumbWidth() |
protected boolean |
isMouseInsideBounds(int x,
int y)
Checks if the mouse cursor is close enough to the slider that the user can start dragging.
|
protected void |
onValueChanged(int value) |
void |
paint(net.minecraft.client.util.math.MatrixStack matrices,
int x,
int y,
int mouseX,
int mouseY)
Paints this widget.
|
void |
setLabel(@Nullable net.minecraft.text.Text label)
Sets the label of this slider.
|
void |
setLabelAlignment(HorizontalAlignment labelAlignment)
Sets the text alignment of this slider's label.
|
void |
setLabelUpdater(@Nullable WLabeledSlider.LabelUpdater labelUpdater)
Sets the
WLabeledSlider.LabelUpdater of this slider. |
void |
setSize(int x,
int y)
Sets the size of this widget.
|
canFocus, canResize, getAxis, getDirection, getDraggingFinishedListener, getMaxValue, getMinValue, getValue, getValueChangeListener, isDecreasingKey, isDragging, isIncreasingKey, onClick, onKeyPressed, onKeyReleased, onMouseDown, onMouseDrag, onMouseScroll, onMouseUp, setDirection, setDraggingFinishedListener, setMaxValue, setMinValue, setValue, setValue, setValueChangeListener, tickaddPainters, 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, validatepublic WLabeledSlider(int min,
int max)
min - the minimum valuemax - the maximum valuepublic WLabeledSlider(int min,
int max,
Axis axis)
min - the minimum valuemax - the maximum valueaxis - the slider axispublic WLabeledSlider(int min,
int max,
Axis axis,
@Nullable
@Nullable net.minecraft.text.Text label)
min - the minimum valuemax - the maximum valueaxis - the slider axislabel - the slider label (can be null)public WLabeledSlider(int min,
int max,
@Nullable
@Nullable net.minecraft.text.Text label)
min - the minimum valuemax - the maximum valuelabel - the slider label (can be null)public void setSize(int x,
int y)
WWidgetOverriding methods may restrict one of the dimensions to be
a constant value, for example super.setSize(x, 20).
setSize in class WAbstractSliderx - the new widthy - the new height@Nullable public @Nullable net.minecraft.text.Text getLabel()
public void setLabel(@Nullable
@Nullable net.minecraft.text.Text label)
label - the new labelprotected void onValueChanged(int value)
onValueChanged in class WAbstractSliderpublic HorizontalAlignment getLabelAlignment()
public void setLabelAlignment(HorizontalAlignment labelAlignment)
labelAlignment - the new alignment@Nullable public @Nullable WLabeledSlider.LabelUpdater getLabelUpdater()
WLabeledSlider.LabelUpdater of this slider.public void setLabelUpdater(@Nullable
@Nullable WLabeledSlider.LabelUpdater labelUpdater)
WLabeledSlider.LabelUpdater of this slider.labelUpdater - the new label updaterprotected int getThumbWidth()
getThumbWidth in class WAbstractSliderprotected boolean isMouseInsideBounds(int x,
int y)
WAbstractSliderisMouseInsideBounds in class WAbstractSliderx - the mouse x positiony - the mouse y position@Environment(value=CLIENT)
public void paint(net.minecraft.client.util.math.MatrixStack matrices,
int x,
int y,
int mouseX,
int mouseY)
WWidget