List of utility methods to do JList Model
void | add(final DefaultListModel add model.clear();
for (Iterator<Object> iterator = collection.iterator(); iterator.hasNext();) {
model.addElement(iterator.next());
|
void | addAll(DefaultListModel m, List o) Adds all Elements from a List to a DefaultListModel for (int i = 0; i < o.size(); i++) { m.addElement(o.get(i)); |
boolean | canHandleModel(JList list) Returns whether the list model can be handled. return (list.getModel() instanceof DefaultListModel); |
ListModel | collectionListModel(Collection collection) Returns a list model of the specified collection. DefaultListModel model = new DefaultListModel(); for (Iterator i = collection.iterator(); i.hasNext();) model.addElement(i.next()); return model; |
DefaultListModel | createDefaultListModel(final Object... elements) create Default List Model final DefaultListModel model = new DefaultListModel(); for (Object o : elements) model.addElement(o); return model; |
JList | createList(final ListModel model) create List @SuppressWarnings("unchecked") JList lst = new JList(model); if (isMacOS_10_5_X) { lst.putClientProperty("JComboBox.isPopDown", Boolean.TRUE); return lst; |
DefaultListModel | generateListModel() generate List Model return new DefaultListModel(); |
DefaultListModel | getDefaultListModel(JList Get the DefaultListModel from JList. return (DefaultListModel<T>) list.getModel();
|
DefaultListModel | getListModel() get List Model return linkListModel;
|
DefaultListModel | getListModel(T[] data) creates a DefaultListModel from an Array DefaultListModel<T> lm = new DefaultListModel<T>(); for (T t : data) { lm.addElement(t); return lm; |