Java JList Model generateListModel()

Here you can find the source of generateListModel()

Description

generate List Model

License

Open Source License

Declaration

private static DefaultListModel generateListModel() 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import javax.swing.*;

public class Main {
    private static ListModel generateListModel(Object[] elements) {
        DefaultListModel listModel = new DefaultListModel();
        if (elements != null) {
            for (Object o : elements) {
                listModel.addElement(o);
            }/*from  www. j  a v a 2 s . c om*/
        }
        return listModel;
    }

    private static DefaultListModel generateListModel(Iterable<?> elements) {
        DefaultListModel listModel = generateListModel();
        if (elements != null) {
            for (Object o : elements) {
                listModel.addElement(o);
            }
        }
        return listModel;
    }

    private static DefaultListModel generateListModel() {
        return new DefaultListModel();
    }
}

Related

  1. addAll(DefaultListModel m, List o)
  2. canHandleModel(JList list)
  3. collectionListModel(Collection collection)
  4. createDefaultListModel(final Object... elements)
  5. createList(final ListModel model)
  6. getDefaultListModel(JList list)
  7. getListModel()
  8. getListModel(T[] data)
  9. hasOnlyValue(final ListModel model, final Object value)