public class SelectBox extends Widget
ChangeListener.ChangeEvent is fired when the selectbox selection changes.
The preferred size of the select box is determined by the maximum text bounds of the items and the size of the
SelectBox.SelectBoxStyle.background.
| Modifier and Type | Class and Description |
|---|---|
static class |
SelectBox.SelectBoxStyle
The style for a select box, see
SelectBox. |
| Constructor and Description |
|---|
SelectBox(java.lang.Object[] items,
SelectBox.SelectBoxStyle style) |
SelectBox(java.lang.Object[] items,
Skin skin) |
SelectBox(java.lang.Object[] items,
Skin skin,
java.lang.String styleName) |
| Modifier and Type | Method and Description |
|---|---|
void |
draw(SpriteBatch batch,
float parentAlpha)
If this method is overridden, the super method or
Widget.validate() should be called to ensure the widget is laid out. |
float |
getPrefHeight() |
float |
getPrefWidth() |
java.lang.String |
getSelection() |
int |
getSelectionIndex() |
SelectBox.SelectBoxStyle |
getStyle()
Returns the select box's style.
|
void |
hideList() |
void |
setItems(java.lang.Object[] objects) |
void |
setSelection(int selection)
Sets the selected item via it's index
|
void |
setSelection(java.lang.String item) |
void |
setStyle(SelectBox.SelectBoxStyle style) |
getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, invalidate, invalidateHierarchy, layout, needsLayout, pack, setFillParent, setLayoutEnabled, validateact, addAction, addCaptureListener, addListener, clear, clearActions, clearListeners, clipBegin, clipBegin, clipEnd, fire, getActions, getCaptureListeners, getColor, getHeight, getListeners, getName, getOriginX, getOriginY, getParent, getRight, getRotation, getScaleX, getScaleY, getStage, getTop, getTouchable, getWidth, getX, getY, getZIndex, hasParent, hit, isAscendantOf, isDescendantOf, isVisible, localToAscendantCoordinates, localToParentCoordinates, localToStageCoordinates, notify, parentToLocalCoordinates, remove, removeAction, removeCaptureListener, removeListener, rotate, scale, scale, screenToLocalCoordinates, setBounds, setColor, setColor, setHeight, setName, setOrigin, setOriginX, setOriginY, setParent, setPosition, setRotation, setScale, setScale, setScaleX, setScaleY, setSize, setStage, setTouchable, setVisible, setWidth, setX, setY, setZIndex, size, size, stageToLocalCoordinates, toBack, toFront, toString, translatepublic SelectBox(java.lang.Object[] items,
Skin skin)
public SelectBox(java.lang.Object[] items,
Skin skin,
java.lang.String styleName)
public SelectBox(java.lang.Object[] items,
SelectBox.SelectBoxStyle style)
public void setStyle(SelectBox.SelectBoxStyle style)
public SelectBox.SelectBoxStyle getStyle()
setStyle(SelectBoxStyle)
is called.public void setItems(java.lang.Object[] objects)
public void draw(SpriteBatch batch, float parentAlpha)
WidgetWidget.validate() should be called to ensure the widget is laid out.public void setSelection(int selection)
selection - the selection indexpublic void setSelection(java.lang.String item)
public int getSelectionIndex()
public java.lang.String getSelection()
public float getPrefWidth()
getPrefWidth in interface LayoutgetPrefWidth in class Widgetpublic float getPrefHeight()
getPrefHeight in interface LayoutgetPrefHeight in class Widgetpublic void hideList()