Retrieves the zero-based index of the currently selected item in a single-selection list box.
public final int getSelectedIndex()
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.
To retrieve an array containing the indices of all selected items in a multiple-selection list box, use the getSelectedIndices method.
See Also setSelectedIndex