Share via


Overview | Methods | This Package | All Packages

OverviewMethodsThis PackageAll Packages

ComboBox.setSelectedItem

Selects the first occurrence of the specified item in a single-selection combo box, and returns the zero-based index of the item.

Syntax

public final int setSelectedItem( Object value )

Parameters

value

The object (generally a String object) to select.

Return Value

Returns the zero-based index of the selected item if it exists in the combo box; returns -1 if the item is not in the combo box.

Remarks

If the specified item is not contained in the combo box, this method returns -1.

See Also   getSelectedItem