Here you can find the source of convertColumnIndexToView(TableColumnModel model, int modelCol)
public static int convertColumnIndexToView(TableColumnModel model, int modelCol)
//package com.java2s; // modify it under the terms of the GNU General Public License import javax.swing.table.TableColumnModel; public class Main { public static int convertColumnIndexToView(TableColumnModel model, int modelCol) { if (modelCol < 0) return modelCol; for (int viewCol = 0; viewCol < model.getColumnCount(); viewCol++) { if (model.getColumn(viewCol).getModelIndex() == modelCol) { return viewCol; }//w w w. j av a 2 s . c o m } return -1; } }