Java JTable Column getColumnIndex(JTable table, String columnTitle)

Here you can find the source of getColumnIndex(JTable table, String columnTitle)

Description

get Column Index

License

Open Source License

Declaration

public static int getColumnIndex(JTable table, String columnTitle) 

Method Source Code

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

import javax.swing.JTable;

public class Main {
    private static final int COLUMN_NOT_FOUND = -1;

    public static int getColumnIndex(JTable table, String columnTitle) {
        int columnCount = table.getColumnCount();

        for (int column = 0; column < columnCount; column++) {
            if (table.getColumnName(column).equalsIgnoreCase(columnTitle)) {
                return column;
            }/*from   ww  w.  j  ava 2 s.com*/
        }

        return COLUMN_NOT_FOUND;
    }
}

Related

  1. findColumn(TableModel model, String name)
  2. fitColumns(JTable table)
  3. FitTableColumns(JTable myTable)
  4. formatStringListToTable(List columnNames, List rows)
  5. getColumnData(final JTable table, final int iSelectedRow)
  6. getColumnIndexFromName(TableModel tableModel, String columnToRemove)
  7. getColumnNames(TableModel tableModel)
  8. getColumnOrder(final JTable table)
  9. getColumns(TableColumnModel columnModel)