Here you can find the source of setValueAt(JTable table, Object value, int row, String columnTitle)
public static void setValueAt(JTable table, Object value, int row, 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 void setValueAt(JTable table, Object value, int row, String columnTitle) { int column = getColumnIndex(table, columnTitle); if (column != COLUMN_NOT_FOUND) { table.setValueAt(value, row, column); }//from w w w. ja v a 2 s. c om } 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; } } return COLUMN_NOT_FOUND; } }