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.
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
I tried the following, it works int lastIndex = tableModel.getRowCount() - 1; Rectangle rect = histLsaTable.getCellRect(lastIndex, 0, true); histLsaTopScrollPane.getViewport().scrollRectToVisible(rect); Thanks everyone.
Post by:autobot
Can you shoot lasers out of your eyes? Don't look at this tiny ad:
a bit of art, as a gift, the permaculture playing cards