Java examples for Swing:JList
A JList can show multiple choices on the screen whereas a JComboBox shows only one selected.
A JList is an expanded version of a JComboBox.
A JList can display a list of choices in one column or multiple columns.
You can create a JList the same way you create a JComboBox, as shown:
Create a JList using an array
import javax.swing.JList; public class Main { public static void main(String[] args) { String[] items = new String[] { "Spring", "Summer", "Fall", "Winter" }; JList<String> list = new JList<>(items); } }