Here you can find the source of rowToModelIndex(JTable table, int row)
public static int rowToModelIndex(JTable table, int row)
//package com.java2s; //License from project: Open Source License import javax.swing.JTable; import javax.swing.RowSorter; public class Main { public static int rowToModelIndex(JTable table, int row) { if (row >= 0) { RowSorter<?> rowSorter = table.getRowSorter(); return rowSorter != null ? rowSorter .convertRowIndexToModel(row) : row; }//from w ww. j a v a2s .c om return -1; } }