ListBox.getSelectedIndex

Overview | Methods | Fields | This Package | All Packages

ListBox.getSelectedIndex

Retrieves the zero-based index of the currently selected item in a single-selection list box.

Syntax

public final int getSelectedIndex()

Return Value

Returns the zero-based index of the currently selected item in a single-selection list box. Returns the zero-based index of the first selected item in a multiple-selection list box. If no item is currently selected, the return value is -1.

Remarks

To retrieve an array containing the indices of all selected items in a multiple-selection list box, use the getSelectedIndices method.

See Also   setSelectedIndex