Package de.gurkenlabs.litiengine.gui
Class DropdownListField
java.lang.Object
de.gurkenlabs.litiengine.gui.GuiComponent
de.gurkenlabs.litiengine.gui.DropdownListField
- All Implemented Interfaces:
IRenderable
,Tweenable
,java.awt.event.MouseListener
,java.awt.event.MouseMotionListener
,java.awt.event.MouseWheelListener
,java.util.EventListener
public class DropdownListField
extends GuiComponent
Field Summary
Fields Modifier and Type Field Description static FontIcon
ARROW_DOWN
Constructor Summary
Constructors Constructor Description DropdownListField(double x, double y, double width, double height, java.lang.Object[] content, int elementsShown)
Method Summary
Modifier and Type Method Description Spritesheet
getButtonSprite()
java.util.List<java.util.function.IntConsumer>
getChangeConsumer()
ImageComponent
getChosenElementComponent()
java.lang.Object[]
getContentArray()
ListField
getContentList()
ImageComponent
getDropDownButton()
Spritesheet
getEntrySprite()
java.util.List<ImageComponent>
getListEntries()
int
getNumberOfShownElements()
int
getSelectedIndex()
java.lang.Object
getSelectedObject()
boolean
isArrowKeyNavigation()
boolean
isDroppedDown()
void
onChange(java.util.function.IntConsumer c)
void
prepare()
Prepare the GuiComponent and all its child Components (Makes the GuiComponent visible and adds mouse listeners.).void
setArrowKeyNavigation(boolean arrowKeyNavigation)
void
setButtonSprite(Spritesheet buttonSprite)
void
setEntrySprite(Spritesheet entrySprite)
void
setSelection(int selectionIndex)
void
setSelection(java.lang.Object selectedObject)
void
toggleDropDown()
Toggle drop down.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, getText, 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, render, setAutomaticLineBreaks, setDimension, setEnabled, setFont, setFontSize, setForwardMouseEvents, setHeight, setHovered, setHoverSound, setLocation, setLocation, setName, setSelected, setTag, setText, setTextAlign, setTextAngle, setTextAntialiasing, setTextShadow, setTextShadowColor, setTextShadowStroke, setTextValign, setTextX, setTextY, setTweenValues, setVisible, setWidth, setX, setY, suspend, toggleSelection, toggleSuspension
Field Details
Constructor Details
DropdownListField
public DropdownListField(double x, double y, double width, double height, java.lang.Object[] content, int elementsShown)
Method Details
getButtonSprite
getChangeConsumer
public java.util.List<java.util.function.IntConsumer> getChangeConsumer()getChosenElementComponent
getContentArray
public java.lang.Object[] getContentArray()getContentList
getDropDownButton
getEntrySprite
getListEntries
getNumberOfShownElements
public int getNumberOfShownElements()getSelectedIndex
public int getSelectedIndex()getSelectedObject
public java.lang.Object getSelectedObject()isArrowKeyNavigation
public boolean isArrowKeyNavigation()isDroppedDown
public boolean isDroppedDown()onChange
public void onChange(java.util.function.IntConsumer c)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
setArrowKeyNavigation
public void setArrowKeyNavigation(boolean arrowKeyNavigation)setButtonSprite
setEntrySprite
setSelection
public void setSelection(int selectionIndex)setSelection
public void setSelection(java.lang.Object selectedObject)toggleDropDown
public void toggleDropDown()Toggle drop down.