ComboBox
Last updated
Last updated
It is a compressed checkbox that, when clicked, expands, allowing the user to choose an item from several possible options
This sample code is only from the ComboBox, to see the complete sample, including the ListBox, go to github.
Type
Name
Description
int
checkColor
Changing the value of this variable will change the color of the RadioButton, that only appears in the Android environment, or the color of the arrow in other evironments where MaterialUI is enabled
Boolean
enableSearch
When the number of items in a ComboBox is greater than 10, an area above the popup list is intended for item searching. By default, the value of this attribute is true, set it to false if you do not want this item search area
String
popupTitle
Changes the popup list title
Boolean
usePopMenu
Assign true to this variable before instanciate a new Combobox to show items in a popup window menu.
Type
Name
Description
Constructor
ComboBox( )
Creates an empty ComboBox
Constructor
ComboBox(Object[ ] items)
Creates a ComboBox with the given items
Constructor
ComboBox(ListBox userListBox)
Creates a ComboBox with a popup list containing the given ListBox. You can create a class that extends a ListBox to draw the items by yourself and then pass it as parameter to this constructor, so the popup list will use your class instead
Constructor
ComboBox(ComboBoxDropDown userPopList)
Creates a ComboBox with the given PopList
void
add(Object item)
Adds an object to the Listbox
void
add(Object[ ] items)
Adds an array of Objects to the Listbox
void
clear( )
Resets the selected index to the value of the defaultClearValueInt attribute; the default value is 0
Object
getItemAt(int i)
Get the object at the given index
Object[ ]
getItems( )
Returns all items in this ComboBox
ListBox
getListBox( )
Returns the ListBox used to show the items of the ComboBox
Object
getSelectedItem( )
Returns the selected item of the ListBox
void
remove(int itemIndex)
Removes an object from the Listbox at the given index
void
remove(Object item)
Removes an object from the Listbox
void
removeAll( )
Empties the items of the ComboBox
void
setItemAt(int i, Object s)
Sets the object at the given index
void
setSelectedIndex(int i)
Select the given index
void
setSelectedIndex(int i, boolean sendPressEvent)
Select the given index, and optionally sends a PRESSED event
void
setSelectedItem(Object name, boolean sendPress)
Select an item, and optionally sends a PRESSED event
See also our quick tutorial video on creating Combo and List Box.
See the Java Docs for more information.