Respuesta :

Answer:

JList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION)

Explanation:

JList provides for simultaneous selection of multiple items upon setting the selection mode to MULTIPLE_INTERVAL_SELECTION. The API call for this purpose is:

jlist.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION)

Once the selection mode has been set , we can select set of items in the list as follows:

jlist.setSelectedIndices({1,3,5});

This will select the items with indices 1,3,5 in the list.