JList list = new JList(); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
JList list = new JList(); list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
JList list = new JList(); list.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);These examples use the javax.swing package library.