I did something like this many years ago. If I remember right I think I got the vertical scroll bar from the JScrollPane and then used the setValue() method of the JScrollBar to set it's position. I also remember that it didn't work on a scroll pane wrapped around a JTextArea. I had to set the curser in the JTextArea to the end of the document because the JScrollPane would automatically scroll to wherever the curser was. If you see similar behavior with your JTable then maybe try seting the selected row to the end of your JTable. Hope it helps.
For a good Prime, call:<br />29819592777931214269172453467810429868925511217482600306406141434158089
Hi, Greg I am also facing the same problem. However, I tried the setSelectedRow() method. In this case cursor moves to that row, but Jscrollpane does not scroll to that place. May be TextArea & JTable have different behavior with JScrollpane. Manoj
posted 16 years ago
I tried the following, it works int lastIndex = tableModel.getRowCount() - 1; Rectangle rect = histLsaTable.getCellRect(lastIndex, 0, true); histLsaTopScrollPane.getViewport().scrollRectToVisible(rect); Thanks everyone.