Converts a visible column index to a column index in the model.
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(); } }