我有一个JTable
,用户应该只能选择一行,但每当用户选择一行时,还应选择其他一些行(根据某些逻辑相关)编程。问题是,如果我将表格的选择模式设置为ListSelectionModel.SINGLE_SELECTION
,addRowSelectionInterval
也只会选择一行。有任何想法吗?
答案 0 :(得分:2)
您可以为表设置多重选择,但每次选择更改时 - 只取1(最后选择的)行,清除其他选择并添加您自己的计算选择。
答案 1 :(得分:2)
The problem is that if I set the selection mode of the table
使用ListSelectionModel.SINGLE_SELECTION
来自mouse
和keyborad
some other rows (that are related according to some logic) should also be selected programmatically