Java tutorial
import javax.swing.JList; import javax.swing.JScrollPane; public class Main { public static void main(String[] argv) throws Exception { String[] items = { "A", "B", "C", "D" }; JList list = new JList(items); JScrollPane scrollingList = new JScrollPane(list); // Make the number of rows dynamic list.setVisibleRowCount(0); } }