Package de.gurkenlabs.litiengine.gui
Class NumberAdjuster
java.lang.Object
de.gurkenlabs.litiengine.gui.GuiComponent
de.gurkenlabs.litiengine.gui.ImageComponent
de.gurkenlabs.litiengine.gui.TextFieldComponent
de.gurkenlabs.litiengine.gui.NumberAdjuster
- All Implemented Interfaces:
IRenderable
,Tweenable
,java.awt.event.MouseListener
,java.awt.event.MouseMotionListener
,java.awt.event.MouseWheelListener
,java.util.EventListener
public class NumberAdjuster
extends TextFieldComponent
Field Summary
Fields Modifier and Type Field Description static FontIcon
ARROW_DOWN
static FontIcon
ARROW_UP
Fields inherited from class de.gurkenlabs.litiengine.gui.TextFieldComponent
DOUBLE_FORMAT, INTEGER_FORMAT
Fields inherited from class de.gurkenlabs.litiengine.gui.ImageComponent
BACKGROUND_DISABLED_INDEX, BACKGROUND_HOVER_INDEX, BACKGROUND_INDEX, BACKGROUND_PRESSED_INDEX
Constructor Summary
Constructors Constructor Description NumberAdjuster(double x, double y, double width, double height, double lowerBound, double upperBound, double startValue, double stepSize)
Method Summary
Modifier and Type Method Description void
decrement()
java.math.BigDecimal
getCurrentValue()
java.math.BigDecimal
getLowerBound()
java.math.BigDecimal
getStepSize()
java.math.BigDecimal
getUpperBound()
void
increment()
void
onValueChange(java.util.function.Consumer<java.math.BigDecimal> cons)
void
prepare()
Prepare the GuiComponent and all its child Components (Makes the GuiComponent visible and adds mouse listeners.).void
setCurrentValue(java.math.BigDecimal newValue)
void
setLowerBound(java.math.BigDecimal lowerBound)
void
setStepSize(java.math.BigDecimal stepSize)
void
setUpperBound(java.math.BigDecimal upperBound)
Methods inherited from class de.gurkenlabs.litiengine.gui.TextFieldComponent
getFormat, getMaxLength, getText, handleTypedKey, onChangeConfirmed, render, setFormat, setMaxLength, setText
Methods inherited from class de.gurkenlabs.litiengine.gui.ImageComponent
getBackground, getImage, getImageAlign, getImageScaleMode, getImageValign, getSpritesheet, rescaleImage, setHeight, setImage, setImageAlign, setImageScaleMode, setImageValign, setSpriteSheet, setWidth
Methods inherited from class de.gurkenlabs.litiengine.gui.GuiComponent
drawTextShadow, getAppearance, getAppearanceDisabled, getAppearanceHovered, getBoundingBox, getClickConsumer, getComponentId, getComponents, getCurrentAppearance, getFont, getHeight, getHoverConsumer, getHoverSound, getLocation, getMouseDraggedConsumer, getMouseEnterConsumer, getMouseLeaveConsumer, getMouseMovedConsumer, getMousePressedConsumer, getMouseReleasedConsumer, getMouseWheelConsumer, getName, getShape, getTag, getTextAlign, getTextAngle, getTextShadowColor, getTextShadowStroke, getTextToRender, getTextValign, getTextX, getTextY, getTweenValues, getWidth, getX, getY, hasAutomaticLineBreaks, hasTextAntialiasing, initializeComponents, isEnabled, isForwardMouseEvents, isHovered, isPressed, isSelected, isSuspended, isVisible, mouseClicked, mouseDragged, mouseEntered, mouseEventShouldBeForwarded, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, onClicked, onHovered, onMouseDragged, onMouseEnter, onMouseLeave, onMouseMoved, onMousePressed, onMouseReleased, onMouseWheelScrolled, onTextChanged, setAutomaticLineBreaks, setDimension, setEnabled, setFont, setFontSize, setForwardMouseEvents, setHovered, setHoverSound, setLocation, setLocation, setName, setSelected, setTag, setTextAlign, setTextAngle, setTextAntialiasing, setTextShadow, setTextShadowColor, setTextShadowStroke, setTextValign, setTextX, setTextY, setTweenValues, setVisible, setX, setY, suspend, toggleSelection, toggleSuspension
Field Details
Constructor Details
NumberAdjuster
public NumberAdjuster(double x, double y, double width, double height, double lowerBound, double upperBound, double startValue, double stepSize)
Method Details
decrement
public void decrement()getCurrentValue
public java.math.BigDecimal getCurrentValue()getLowerBound
public java.math.BigDecimal getLowerBound()getStepSize
public java.math.BigDecimal getStepSize()getUpperBound
public java.math.BigDecimal getUpperBound()increment
public void increment()onValueChange
public void onValueChange(java.util.function.Consumer<java.math.BigDecimal> cons)prepare
public void prepare()Description copied from class:GuiComponent
Prepare the GuiComponent and all its child Components (Makes the GuiComponent visible and adds mouse listeners.). This is, for example, done right before switching to a new screen.- Overrides:
prepare
in classGuiComponent
setCurrentValue
public void setCurrentValue(java.math.BigDecimal newValue)setLowerBound
public void setLowerBound(java.math.BigDecimal lowerBound)setStepSize
public void setStepSize(java.math.BigDecimal stepSize)setUpperBound
public void setUpperBound(java.math.BigDecimal upperBound)