Java JList Item getListItems(JList list)

Here you can find the source of getListItems(JList list)

Description

get List Items

License

Apache License

Declaration

public static Object[] getListItems(JList list) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import javax.swing.*;

public class Main {
    public static Object[] getListItems(JList list) {
        ListModel lm = list.getModel();
        synchronized (lm) {
            Object[] ret = new Object[lm.getSize()];
            for (int i = 0; i < ret.length; i++) {
                ret[i] = lm.getElementAt(i);

            }// w w  w.ja  va  2  s. c  o m
            return ret;
        }
    }
}

Related

  1. getItemList(JList anJList, int index)
  2. getItems(JList list)
  3. getJListItemAry(javax.swing.JList jlist)