Java JList Item getJListItemAry(javax.swing.JList jlist)

Here you can find the source of getJListItemAry(javax.swing.JList jlist)

Description

get J List Item Ary

License

Open Source License

Declaration

public static String[] getJListItemAry(javax.swing.JList jlist) 

Method Source Code

//package com.java2s;
/*//w w  w.  j  a v  a2  s .c o m
 * @(#)RunUtilFunc.java   
 *
 * Copyright (C) 2006-2007 www.interpss.org
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE
 * as published by the Free Software Foundation; either version 2.1
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * @Author Mike Zhou
 * @Version 1.0
 * @Date 12/15/2007
 * 
 *   Revision History
 *   ================
 *
 */

public class Main {
    public static String[] getJListItemAry(javax.swing.JList jlist) {
        int size = jlist.getModel().getSize();
        String[] ary = new String[size];
        for (int i = 0; i < size; i++) {
            ary[i] = (String) jlist.getModel().getElementAt(i);
        }
        return ary;
    }
}

Related

  1. getItemList(JList anJList, int index)
  2. getItems(JList list)
  3. getListItems(JList list)