Aleah2232 Aleah2232
  • 19-07-2019
  • Computers and Technology
contestada

How can multiple items be selected at the same time in aJList?

Respuesta :

Branta Branta
  • 01-08-2019

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.

Answer Link

Otras preguntas

Express 396 as a product of prime numbers in index form
How can I compare the two stages of cellular respiration ?
to buy a new computer for $2100. The computer decreases by 50% annually. When with the computer have a value of $600?
Is 1.6 more than, less than, or equal to one and a half? Explain why
who sold Land to the Quakers in new Jersey
28:22:24 ratio simplyfied
Calculate the maximum kinetic energy of photoelectrons emitted from this plate when light of wavelength (λ) 520nm is directed at the metal surface. Work functio
How can you determine a unit rate for a situation and give an example
A company manufacturing computer chips finds that 8% of all chips manufactured are defective. Management is concerned that high employee turnover is partially r
How does a nymph grow into a mature adult?