[英]How set focus in multiple rows in Jtable?
changeSelection(....)
方法用於選擇哪個單元格/行具有焦點。 addSelectionInterval
用於選擇多行。
因此,代碼順序為:
table.getSelectionModel().addSelectionInterval(5, 5);
table.getSelectionModel().addSelectionInterval(3, 3);
table.changeSelection(1, 1, true, false);
為了使焦點集中在第2行,並選擇了第2行,第3行,我嘗試了這一點,它的工作是:
table.changeSelection(2, 1, true, false);
table.getSelectionModel().addSelectionInterval(2, 3);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.