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); // The default layout orientation is JList.VERTICAL int orient = list.getLayoutOrientation(); // Change the layout orientation to left-to-right, top-to-bottom list.setLayoutOrientation(JList.HORIZONTAL_WRAP); } }