Share via


Overview | Methods | This Package | All Packages

OverviewMethodsThis PackageAll Packages

ComboBox.addItem

Adds an item to the combo box and returns the index of the new item.

Syntax

public final int addItem( Object item )

Parameters

item

An object (generally a String object) whose toString method returns the string you want to display in the combo box.

Return Value

Returns the zero-based index of where the item was inserted.

Remarks

If the sorted property of the combo box is set to true, the item is inserted into the list alphabetically. Otherwise, the item is inserted at the end of the list. To insert an item into the combo box at a specific position, use the insertItem method. To add a set of items to the combo box at one time, use the setItems method.

See Also   removeItem