Class VerticalSlider
java.lang.Object
de.gurkenlabs.litiengine.gui.GuiComponent
de.gurkenlabs.litiengine.gui.Slider
de.gurkenlabs.litiengine.gui.VerticalSlider
- All Implemented Interfaces:
IRenderable, Tweenable, MouseListener, MouseMotionListener, MouseWheelListener, EventListener
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final FontIconIcon used by the increment button below the slider.static final FontIconIcon used by the decrement button above the slider.Fields inherited from class GuiComponent
ICON_FONT -
Constructor Summary
ConstructorsConstructorDescriptionVerticalSlider(double x, double y, double width, double height, float minValue, float maxValue, float stepSize) Creates a vertical slider. -
Method Summary
Modifier and TypeMethodDescriptionprotected floatComputes a normalized value (typically in[0, 1]) corresponding to the current mouse location relative to the slider.Computes the relative location of the slider thumb within the slider for the current value.protected voidInitialize child components.protected voidRenders the slider bar (track).protected voidRenders the slider tick marks.protected booleanshouldDecreaseOnKey(int keyCode) Determines whether the slider value should be decreased when the given key is typed.protected booleanshouldIncreaseOnKey(int keyCode) Determines whether the slider value should be increased when the given key is typed.protected voidUpdates the geometry of the slider in response to a change in min/max value or step size.Methods inherited from class Slider
getButton1, getButton2, getButtonSpritesheet, getChangeConsumer, getCurrentValue, getMaxValue, getMinValue, getSliderComponent, getSliderSpritesheet, getSteps, getStepSize, getTickSize, inferValueFromMouseLocation, isDragging, isShowingTicks, onChange, prepare, render, setButton1, setButton2, setButtonSpritesheet, setCurrentValue, setMaxValue, setMinValue, setShowTicks, setSliderComponent, setSliderSpritesheet, setStepSize, setTickSizeMethods inherited from class GuiComponent
addRenderedListener, addRenderListener, getAppearance, getAppearanceDisabled, getAppearanceHovered, getBoundingBox, getCenterX, getCenterY, getClickConsumer, getComponentId, getComponents, getCurrentAppearance, getFocusedComponent, getFont, getHeight, getHoverConsumer, getHoverSound, getLocation, getMouseDraggedConsumer, getMouseEnterConsumer, getMouseLeaveConsumer, getMouseMovedConsumer, getMousePressedConsumer, getMouseReleasedConsumer, getMouseWheelConsumer, getName, getShape, getTag, getText, getTextAlign, getTextAngle, getTextShadowColor, getTextShadowRadius, getTextToRender, getTextValign, getTextX, getTextY, getTweenValues, getWidth, getX, getY, hasAutomaticLineBreaks, hasInputFocus, hasTextAntialiasing, hasTextShadow, isAutoScaling, isEnabled, isFocusable, isForwardMouseEvents, isHovered, isPressed, isSelected, isSuspended, isVisible, mouseClicked, mouseDragged, mouseEntered, mouseEventShouldBeForwarded, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, onClicked, onHovered, onMouseDragged, onMouseEnter, onMouseLeave, onMouseMoved, onMousePressed, onMouseReleased, onMouseWheelScrolled, onResolutionChanged, onTextChanged, removeListener, removeListener, setAutomaticLineBreaks, setAutoScaling, setDimension, setEnabled, setFocusable, setFont, setFontSize, setForwardMouseEvents, setHeight, setHovered, setHoverSound, setLocation, setLocation, setName, setSelected, setTag, setText, setTextAlign, setTextAngle, setTextAntialiasing, setTextShadow, setTextShadowColor, setTextShadowRadius, setTextValign, setTextX, setTextY, setTweenValues, setVisible, setWidth, setX, setY, suspend, toggleSelection, toggleSuspension
-
Field Details
-
ARROW_DOWN
Icon used by the increment button below the slider. -
ARROW_UP
Icon used by the decrement button above the slider.
-
-
Constructor Details
-
VerticalSlider
public VerticalSlider(double x, double y, double width, double height, float minValue, float maxValue, float stepSize) Creates a vertical slider.- Parameters:
x- The horizontal screen coordinate.y- The vertical screen coordinate.width- The component width.height- The component height.minValue- The value at the top.maxValue- The value at the bottom.stepSize- The amount changed by one step.
-
-
Method Details
-
getRelativeSliderLocation
Description copied from class:SliderComputes the relative location of the slider thumb within the slider for the current value.- Specified by:
getRelativeSliderLocationin classSlider- Returns:
- the relative location of the slider thumb
-
updateSliderDimensions
protected void updateSliderDimensions()Description copied from class:SliderUpdates the geometry of the slider in response to a change in min/max value or step size.- Specified by:
updateSliderDimensionsin classSlider
-
renderBar
Description copied from class:SliderRenders the slider bar (track). -
renderTicks
Description copied from class:SliderRenders the slider tick marks.- Specified by:
renderTicksin classSlider- Parameters:
g- the graphics context to draw to
-
getRelativeMouseValue
protected float getRelativeMouseValue()Description copied from class:SliderComputes a normalized value (typically in[0, 1]) corresponding to the current mouse location relative to the slider.- Specified by:
getRelativeMouseValuein classSlider- Returns:
- the relative mouse value
-
initializeComponents
protected void initializeComponents()Description copied from class:GuiComponentInitialize child components.- Overrides:
initializeComponentsin classGuiComponent
-
shouldIncreaseOnKey
protected boolean shouldIncreaseOnKey(int keyCode) Description copied from class:SliderDetermines whether the slider value should be increased when the given key is typed.- Overrides:
shouldIncreaseOnKeyin classSlider- Parameters:
keyCode- the typed key code- Returns:
trueif the value should be increased
-
shouldDecreaseOnKey
protected boolean shouldDecreaseOnKey(int keyCode) Description copied from class:SliderDetermines whether the slider value should be decreased when the given key is typed.- Overrides:
shouldDecreaseOnKeyin classSlider- Parameters:
keyCode- the typed key code- Returns:
trueif the value should be decreased
-