2012-11-19 54 views
0

我有一個JTable。最多隻顯示四行,而所有行的數量爲八。我想在程序啓動的時候,表格會直接導致最後一行。顯示JTable中的最後一行,Java

這裏當程序啓動:

enter image description here

我要像這樣,當程序啓動:

enter image description here

表直接導致了最後排

+0

爲了更好地幫助越早這樣做,張貼[SSCCE(http://sscce.org/)。 –

回答

2

你也可以用下面的代碼

int lastRow=table.getRowCount-1; 

    table.setCellSelectionEnabled(true); 
    table.changeSelection(lastRow, 0, false, false); 
    table.scrollRectToVisible(new Rectangle(tblDetailInfo.getCellRect(lastRow, 0, true))); 
相關問題