|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.badlogic.gdx.scenes.scene2d.Actor
com.badlogic.gdx.scenes.scene2d.ui.Widget
com.badlogic.gdx.scenes.scene2d.ui.SelectBox
public class SelectBox
A select box (aka a drop-down list) allows a user to choose one of a number of values from a list. When inactive, the selected value is displayed. When activated, it shows the list of values that may be selected.
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
.
Nested Class Summary | |
---|---|
static class |
SelectBox.SelectBoxStyle
The style for a select box, see SelectBox . |
Constructor Summary | |
---|---|
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)
|
Method Summary | |
---|---|
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)
|
Methods inherited from class com.badlogic.gdx.scenes.scene2d.ui.Widget |
---|
getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, invalidate, invalidateHierarchy, layout, needsLayout, pack, setFillParent, setLayoutEnabled, validate |
Methods inherited from class com.badlogic.gdx.scenes.scene2d.Actor |
---|
act, addAction, addCaptureListener, addListener, clearActions, 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, translate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public 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)
Method Detail |
---|
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)
Widget
Widget.validate()
should be called to ensure the widget is laid out.
draw
in class Widget
parentAlpha
- Should be multipied with the actor's alpha, allowing a parent's alpha to affect all children.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 Layout
getPrefWidth
in class Widget
public float getPrefHeight()
getPrefHeight
in interface Layout
getPrefHeight
in class Widget
public void hideList()
|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |