Here you can find the source of scrollToVisible(final JTable table, final int rowIndex, final int vColIndex)
public static void scrollToVisible(final JTable table, final int rowIndex, final int vColIndex)
//package com.java2s; //License from project: Open Source License import java.awt.Point; import java.awt.Rectangle; import javax.swing.JViewport; import javax.swing.JTable; public class Main { public static void scrollToVisible(final JTable table, final int rowIndex, final int vColIndex) { if (!(table.getParent() instanceof JViewport)) { return; }/*from www . j av a 2s. com*/ final JViewport viewport = (JViewport) table.getParent(); final Rectangle rect = table.getCellRect(rowIndex, vColIndex, true); final Point pt = viewport.getViewPosition(); rect.setLocation(rect.x - pt.x, rect.y - pt.y); viewport.scrollRectToVisible(rect); } }