table.scrollRectToVisible(new Rectangle(tblDetailInfo.getCellRect(lastRow, 0, true)));
table.changeSelection(lastRow, 0, false, false);
table.setCellSelectionEnabled(true);
int lastRow=table.getRowCount-1;
You can also do this with the following code
table.scrollRectToVisible(cellBounds);
Armed with this information, you simply need to call to request that the given rectangle is made visible.
Should give you the location of the given cell.
Rectangle cellBounds = table.getCellRect(table.getRowCount() - 1, 0, true);
You need to get the cell bounds for the last row, will return the rectangle bounds of a given cell, so something like;
For better help sooner, post an . – Nov 19 '12 at 2:08
table directly leads to the last row
I want to like this when program is start :
here's when the program is start :
I have a JTable. Maximum row displayed only four, while the number of all rows of eight. I want when the program starts the table will directly lead to the last row.
swing - display last row in JTable,Java - Stack Overflow
Комментариев нет:
Отправить комментарий