List of usage examples for javax.swing JViewport getViewPosition
public Point getViewPosition()
From source file:xtrememp.PlaylistManager.java
public void makeRowVisible(int rowIndex) { if (!(playlistTable.getParent() instanceof JViewport)) { return;/* w w w.j a va 2 s .c o m*/ } JViewport viewport = (JViewport) playlistTable.getParent(); Rectangle contentRect = (Rectangle) playlistTable .getCellRect(rowIndex, playlistTable.getSelectedColumn(), true).clone(); Point pt = viewport.getViewPosition(); contentRect.setLocation(contentRect.x - pt.x, contentRect.y - pt.y); viewport.scrollRectToVisible(contentRect); }