Here you can find the source of scrollToLastSelectedRow(final JTable table)
public static void scrollToLastSelectedRow(final JTable table)
//package com.java2s; //License from project: Open Source License import javax.swing.*; import java.awt.*; public class Main { public static void scrollToLastSelectedRow(final JTable table) { if (table == null) { return; }/* w w w . j av a2 s. c o m*/ int[] selectedRows = table.getSelectedRows(); if (selectedRows.length > 0) { scrollToVisible(table, selectedRows[selectedRows.length - 1], 0); } } public static void scrollToVisible(final JTable table, int rowIndex, int vColIndex) { if (table == null || !(table.getParent() instanceof JViewport)) { return; } JViewport viewport = (JViewport) table.getParent(); try { final Rectangle rect = table.getCellRect(rowIndex, vColIndex, true); Point pt = viewport.getViewPosition(); rect.setLocation(rect.x - pt.x, rect.y - pt.y); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { table.scrollRectToVisible(rect); } }); } catch (Exception e) { } } }