|
||||||||||
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.List<T>
public class List<T>
A list (aka list box) displays textual items and highlights the currently selected item.
ChangeListener.ChangeEvent
is fired when the list selection changes.
The preferred size of the list is determined by the text bounds of the items and the size of the List.ListStyle.selection
.
Nested Class Summary | |
---|---|
static class |
List.ListStyle
The style for a list, see List . |
Constructor Summary | |
---|---|
List(List.ListStyle style)
|
|
List(Skin skin)
|
|
List(Skin skin,
String styleName)
|
Method Summary | |
---|---|
void |
draw(Batch 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 |
getItemHeight()
|
Array<T> |
getItems()
|
float |
getPrefHeight()
|
float |
getPrefWidth()
|
T |
getSelected()
Returns the first selected item, or null. |
int |
getSelectedIndex()
|
ArraySelection<T> |
getSelection()
|
List.ListStyle |
getStyle()
Returns the list's style. |
void |
layout()
Computes and caches any information needed for drawing and, if this actor has children, positions and sizes each child, calls Layout.invalidate() any each child whose width or height has changed, and calls Layout.validate() on each child. |
void |
setCullingArea(Rectangle cullingArea)
|
void |
setItems(Array newItems)
Sets the current items, clearing the selection if it is no longer valid. |
void |
setItems(T... newItems)
|
void |
setSelectedIndex(int index)
Sets the selection to only the selected index. |
void |
setStyle(List.ListStyle style)
|
Methods inherited from class com.badlogic.gdx.scenes.scene2d.ui.Widget |
---|
getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, invalidate, invalidateHierarchy, needsLayout, pack, setFillParent, setLayoutEnabled, validate |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public List(Skin skin)
public List(Skin skin, String styleName)
public List(List.ListStyle style)
Method Detail |
---|
public void setStyle(List.ListStyle style)
public List.ListStyle getStyle()
setStyle(ListStyle)
is called.
public void layout()
Layout
Layout.invalidate()
any each child whose width or height has changed, and calls Layout.validate()
on each child.
This method should almost never be called directly, instead Layout.validate()
should be used.
layout
in interface Layout
layout
in class Widget
public void draw(Batch batch, float parentAlpha)
Widget
Widget.validate()
should be called to ensure the widget is laid out.
draw
in class Widget
parentAlpha
- Should be multiplied with the actor's alpha, allowing a parent's alpha to affect all children.public ArraySelection<T> getSelection()
public T getSelected()
public int getSelectedIndex()
public void setSelectedIndex(int index)
public void setItems(T... newItems)
public void setItems(Array newItems)
Selection.getRequired()
, the first item is selected.
public Array<T> getItems()
public float getItemHeight()
public float getPrefWidth()
getPrefWidth
in interface Layout
getPrefWidth
in class Widget
public float getPrefHeight()
getPrefHeight
in interface Layout
getPrefHeight
in class Widget
public void setCullingArea(Rectangle cullingArea)
setCullingArea
in interface Cullable
cullingArea
- The culling area in the child actor's coordinates.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |