Java JTable Column findColumn(TableModel model, String name)

Here you can find the source of findColumn(TableModel model, String name)

Description

find Column

License

Open Source License

Declaration

static int findColumn(TableModel model, String name) 

Method Source Code


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

import javax.swing.table.TableModel;

public class Main {
    static int findColumn(TableModel model, String name) {
        for (int i = 0; i < model.getColumnCount(); i++) {
            if (name.equals(model.getColumnName(i))) {
                return i;
            }//from  w ww .  j  av a 2  s.c  om
        }
        return -1;
    }
}

Related

  1. createDefaultTableModel(String[] columnNames)
  2. createUneditableTableModel(String... columnNames)
  3. ensureColumnCount(int count, JTable table)
  4. filterTable(JTable table, DefaultTableModel dtm, String text, int[] columns, boolean forceRegEx)
  5. findColumn(TableModel m, String columnName)
  6. fitColumns(JTable table)
  7. FitTableColumns(JTable myTable)
  8. formatStringListToTable(List columnNames, List rows)
  9. getColumnData(final JTable table, final int iSelectedRow)