12.13 Multiple-Selection Lists
A multiple-selection list enables the user to select many items from a JList
(see the output of Fig. 12.26). A SINGLE_INTERVAL_SELECTION
list allows selecting a contiguous range of items. To do so, click the first item, then press and hold the Shift key while clicking the last item in the range. A MULTIPLE_INTERVAL_SELECTION
list (the default) allows continuous range selection as described for a SINGLE_INTERVAL_SELECTION
list. Such a list also allows miscellaneous items to be selected by pressing and holding the Ctrl key while clicking each item to select. To deselect an item, press and hold the Ctrl key while clicking the item a second time.
The application of Figs. 12.25–12.26 uses multiple-selection lists to ...
Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.