Java tutorial
import javax.swing.JTable; public class Main { public static void main(String[] argv) { } public int toModel(JTable table, int vColIndex) { if (vColIndex >= table.getColumnCount()) { return -1; } return table.getColumnModel().getColumn(vColIndex).getModelIndex(); } }