to set focus in multiple rows in table I did:
table.getSelectionModel().addSelectionInterval( idx1, idx2);
table.requestFocus();
I try also
table.addRowSelectionInterval( idx1, idx2);
But I did not find a result.
Finally I tried:
table.requestFocus();
table.changeselection(row, col, true, false)
But I cannot select multiple rows like this:
The changeSelection(....)
method is used to select which cell/row has focus. The addSelectionInterval
is used to select multiple rows.
So the order of code would be:
table.getSelectionModel().addSelectionInterval(5, 5);
table.getSelectionModel().addSelectionInterval(3, 3);
table.changeSelection(1, 1, true, false);
to make focus in row 2 and the two rows 2, 3 are selected, I tried this and it's work:
table.changeSelection(2, 1, true, false);
table.getSelectionModel().addSelectionInterval(2, 3);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.