Java JList indexList(JList list, Object object)

Here you can find the source of indexList(JList list, Object object)

Description

index List

License

LGPL

Declaration

public static int indexList(JList list, Object object) 

Method Source Code

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

import javax.swing.*;

public class Main {
    public static int indexList(JList list, Object object) {
        ListModel model = list.getModel();
        if (model == null) {
            model = new DefaultListModel();
            list.setModel(model);//from   w w w.  j  a  v a2s . c  om
        }
        ;
        if (model instanceof DefaultListModel) {
            DefaultListModel listModel = (DefaultListModel) model;
            return listModel.indexOf(object);
        }
        return -1;
    }
}

Related

  1. ensureCustomBackgroundStored(JList comp)
  2. ensureRangeIsVisible(JList list, int top, int bottom)
  3. filterDataList(JList jList, List dataList, String text)
  4. getStoredBackground(JList comp)
  5. getVisibleRowCount(JList list)
  6. indexOf(JList jList, Object obj)
  7. isDoubleClick(MouseEvent evt, JList lst, JButton btn)
  8. isIndexFullyVisible(JList list, int index)
  9. JListClearData(javax.swing.JList list)