Here you can find the source of modelIndexToDisplayIndex(JTable table, int modelIndex)
public static int modelIndexToDisplayIndex(JTable table, int modelIndex)
//package com.java2s; //License from project: Open Source License import javax.swing.JTable; import javax.swing.RowSorter; public class Main { public static int modelIndexToDisplayIndex(JTable table, int modelIndex) { if (modelIndex >= 0) { RowSorter<?> rowSorter = table.getRowSorter(); return rowSorter != null ? rowSorter .convertRowIndexToView(modelIndex) : modelIndex; }/*from w ww . j a v a 2 s . co m*/ return -1; } }