title: Scroll a JScrollPane to a specific row on a JTable
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/853020/jtable-scrolling-to-a-specified-row-index">JTable Scrolling to a specified row index</a>  </p>
  </blockquote>
  
  
  
  <p>I have a JTable and I programmatically need to select a row by using this code:</p>
  
  <pre><code>  myTable.setRowSelectionInterval(i, j);
  </code></pre>
  
  <p>(where i and j are valid row and column numbers respectively).</p>
  
  <p>The problem is, when you jump to a row, the JScrollPane does not move.
  In this case, the table is quite long, and often the "selected row" is not visible on the screen, so the user has to stay scrolling up/down manually to find it. I would like to know how I can make the JScrollPane automatically jump to the specific location of the row.</p>
  
  <p>Edit: Found this one liner which can do it:</p>
  
  <pre><code>table.scrollRectToVisible(table.getCellRect(row,0, true)); 
  </code></pre>