
Useful Methods of the JList Class
Return value Method name and argument list
void addListSelectionListener(
ListSelectionListener handler )
registers an event handler for ItemEvents fired by this list.
int getSelectedIndex( )
returns the index of the selected item.The index of the first item
in the list is 0.
void setSelectedIndex( int index )
selects the item at index.The index of the first item in the list is 0.
void setSelectionMode( int selectionMode )
sets the number of selections that can be made at one time.The
following static int constants of the ListSelectionModel interface
can be used to set the selection mode:
SINGLE_SELECTION—one selection allowed ...