Here you can find the source of getColumnIndex(JTable table, String columnTitle)
public static int getColumnIndex(JTable table, String columnTitle)
//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; } }