(Copy)
JList doesn't support scrolling directly. To create a scrolling list you make the JList the viewport view of a JScrollPane, e.g.
JScrollPane scrollPane = new JScrollPane(dataList);
// Or in two steps:
JScrollPane scrollPane = new JScrollPane();
scrollPane.getViewport().setView(dataList);
By default JList supports single selection, i.e. zero or one index can be selected. The selection state is actually managed by a separate delegate object, an implementation of ListSelectionModel however JList provides convenient properties for managing the selection.
String[] data = {"one", "two", "free", "four"};
JList dataList = new JList(data);