Java examples for Swing:JList
JList ListModel to List
//package com.java2s; import java.util.ArrayList; import java.util.List; import javax.swing.ListModel; public class Main { public static List toList(ListModel model) { ArrayList list = new ArrayList(model.getSize()); for (int i = 0; i < model.getSize(); i++) { list.add(model.getElementAt(i)); }/*ww w.jav a2 s . c o m*/ return (list); } }