Here you can find the source of getRealRowPos(int rowPos, JTable table)
public static int getRealRowPos(int rowPos, JTable table)
//package com.java2s; import javax.swing.JTable; public class Main { public static int getRealRowPos(int rowPos, JTable table) { if (rowPos == -1) { // System.out.println("getRealRowPos => " + rowPos); return rowPos; }/*from w w w . ja va 2 s .c o m*/ if (table.getRowSorter() == null) { // System.out.println("getRealRowPos[no sort] => " + rowPos); return rowPos; } int fixRowPos = table.getRowSorter().convertRowIndexToModel(rowPos); // System.out.println(String.format("getRealRowPos[fix] => before[%d], // after[%d]", rowPos, fixRowPos)); return fixRowPos; } }