public class DropdownList extends Widget
SCROLL_DIR_ALL, SCROLL_DIR_BOTTOM, SCROLL_DIR_HORIZONTAL, SCROLL_DIR_LEFT, SCROLL_DIR_NONE, SCROLL_DIR_RIGHT, SCROLL_DIR_TOP, SCROLL_DIR_VERTICAL, SCROLLBAR_MODE_ACTIVE, SCROLLBAR_MODE_AUTO, SCROLLBAR_MODE_OFF, SCROLLBAR_MODE_ON, STATE_CHECKED, STATE_DEFAULT, STATE_DISABLED, STATE_SCROLLED
ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_DEFAULT, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_TOP, objImpl, SIDE_BOTTOM, SIDE_FULL, SIDE_LEFT, SIDE_RIGHT, SIDE_TOP, SIZE_CONTENT, TEXT_DECOR_NONE, TEXT_DECOR_STRIKETHROUGH, TEXT_DECOR_UNDERLINE
Constructor and Description |
---|
DropdownList()
Constructs a drop-down list
|
Modifier and Type | Method and Description |
---|---|
void |
addOption(String option)
Adds an option to the end of the list
|
String[] |
getOptions()
Returns an array contains all options of the list
|
int |
getSelected()
Gets the index of the selected option
|
void |
insertOption(int index,
String option)
Inserts an option to the list at the specified index.
|
int |
optionSize()
Returns the number of options of the list
|
void |
removeOption(String option)
Removes an option from the list
|
void |
setSelected(int index)
Selects an option of the list
|
getContainer
getObjectOfState, getScrollbar, getScrollbarMode, getScrollbarOfState, getScrollBottom, getScrollDirection, getScrollLeft, getScrollRight, getScrollTop, getScrollX, getScrollY, isChecked, isClickable, isDisabled, isFloating, isHidden, isIgnoreLayout, isScrollable, isScrolled, resetAllListeners, scrollToView, scrollToView, scrollToX, scrollToX, scrollToY, scrollToY, setCancelListener, setChecked, setClickable, setClickedListener, setDisabled, setFloating, setHidden, setIgnoreLayout, setReadyListener, setScrollable, setScrollbarMode, setScrollDirection, setScrollListener, setValueChangedListener
enableClipCorner, forceNewTrack, getBackgroundColor, getBorderColor, getBorderWidth, getColumnPadding, getCoordinates, getFlexGrow, getHeight, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getName, getPadding, getParent, getPropertyBooleanValue, getPropertyIntValue, getRadius, getRowPadding, getShadowColor, getShadowOffsetX, getShadowOffsetY, getShadowWidth, getTextColor, getTextLetterSpace, getTextLineSpace, getTranslateX, getTranslateY, getUserData, getWidth, getX, getY, isClipCornerEnabled, setAlign, setBackgroundColor, setBorderColor, setBorderWidth, setColumnPadding, setFlexGrow, setHeight, setMaxHeight, setMaxWidth, setMinHeight, setMinWidth, setName, setPadding, setPadding, setParent, setPos, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setRadius, setRecolor, setRowPadding, setShadowColor, setShadowOffsetX, setShadowOffsetY, setShadowWidth, setSize, setTextAlign, setTextColor, setTextDecor, setTextFont, setTextLetterSpace, setTextLineSpace, setTranslateX, setTranslateY, setUserData, setWidth, setX, setY
public void addOption(String option)
option
- a stringpublic void removeOption(String option)
option
- a stringpublic void insertOption(int index, String option)
Each option in the list with an index greater or equal to the specified
index
is shifted upward to have an index one greater than
the value it had previously.
The index must be a value greater than or equal to 0
and
less than or equal to the current number of options of the list.
index
- where to insert the new optionoption
- a stringpublic int optionSize()
public String[] getOptions()
public void setSelected(int index)
index
- the index of the optionpublic int getSelected()