Class CheckBox
java.lang.Object
de.gurkenlabs.litiengine.gui.GuiComponent
de.gurkenlabs.litiengine.gui.ImageComponent
de.gurkenlabs.litiengine.gui.CheckBox
- All Implemented Interfaces:
IRenderable,Tweenable,MouseListener,MouseMotionListener,MouseWheelListener,EventListener
A GUI component representing a checkbox with an optional spritesheet.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final FontIconThe icon representing a checked state.static final FontIconThe icon representing an unchecked state.Fields inherited from class de.gurkenlabs.litiengine.gui.ImageComponent
BACKGROUND_DISABLED_INDEX, BACKGROUND_HOVER_INDEX, BACKGROUND_INDEX, BACKGROUND_PRESSED_INDEXFields inherited from class de.gurkenlabs.litiengine.gui.GuiComponent
ICON_FONT -
Constructor Summary
ConstructorsConstructorDescriptionCheckBox(double x, double y, double width, double height, Spritesheet spritesheet, boolean checked) Constructs a new CheckBox. -
Method Summary
Modifier and TypeMethodDescriptionGets the list of consumers to be notified when the checked state changes.booleanChecks if the checkbox is currently checked.voidAdds a consumer to be notified when the checked state changes.voidsetChecked(boolean checked) Sets the checked state of the checkbox.Methods inherited from class de.gurkenlabs.litiengine.gui.ImageComponent
getBackground, getHorizontalImagePadding, getImage, getImageAlign, getImageScaleInterpolation, getImageScaleMode, getImageValign, getSpritesheet, getSpritesheetScaleFactor, getSpritesheetScaleInterpolation, getSpritesheetScaleMode, getVerticalImagePadding, render, rescaleImage, setHeight, setHorizontalImagePadding, setImage, setImageAlign, setImageScaleInterpolation, setImageScaleMode, setImageValign, setSpritesheet, setSpritesheet, setSpritesheet, setSpritesheetScaleFactor, setSpritesheetScaleInterpolation, setSpritesheetScaleMode, setVerticalImagePadding, setWidthMethods inherited from class de.gurkenlabs.litiengine.gui.GuiComponent
addRenderedListener, addRenderListener, getAppearance, getAppearanceDisabled, getAppearanceHovered, getBoundingBox, getCenterX, getCenterY, getClickConsumer, getComponentId, getComponents, getCurrentAppearance, 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, hasTextAntialiasing, hasTextShadow, 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, prepare, removeListener, removeListener, setAutomaticLineBreaks, setDimension, setEnabled, setFont, setFontSize, setForwardMouseEvents, setHovered, setHoverSound, setLocation, setLocation, setName, setSelected, setTag, setText, setTextAlign, setTextAngle, setTextAntialiasing, setTextShadow, setTextShadowColor, setTextShadowRadius, setTextValign, setTextX, setTextY, setTweenValues, setVisible, setX, setY, suspend, toggleSelection, toggleSuspension
-
Field Details
-
CHECK
The icon representing a checked state. -
CROSS
The icon representing an unchecked state.
-
-
Constructor Details
-
CheckBox
public CheckBox(double x, double y, double width, double height, Spritesheet spritesheet, boolean checked) Constructs a new CheckBox.- Parameters:
x- the x-coordinate of the checkboxy- the y-coordinate of the checkboxwidth- the width of the checkboxheight- the height of the checkboxspritesheet- the spritesheet for the checkboxchecked- the initial checked state of the checkbox
-
-
Method Details
-
getChangeConsumer
-
isChecked
public boolean isChecked()Checks if the checkbox is currently checked.- Returns:
- true if the checkbox is checked, false otherwise
-
onChange
-
setChecked
public void setChecked(boolean checked) Sets the checked state of the checkbox.- Parameters:
checked- the new checked state
-