Here you can find the source of getLastVisibleRow(JTable p_Table)
public static int getLastVisibleRow(JTable p_Table)
//package com.java2s; //License from project: Open Source License import java.awt.Point; import javax.swing.JTable; public class Main { public static int getLastVisibleRow(JTable p_Table) { Point p = p_Table.getVisibleRect().getLocation(); p.y = p.y + p_Table.getVisibleRect().height - 1; int result = p_Table.rowAtPoint(p); if (result > 0) return result; // if there is no rows at this point,rowatpoint() return -1, // It means that there is not enough rows to fill the rectangle where // the table is displayed. // if this case we return getRowCount()-1 because // we are sure that the last row is visible if (p_Table.getVisibleRect().height > 0) return p_Table.getRowCount() - 1; else/*from w ww . j a v a2 s .c o m*/ return -1; } }