문제

I want to programmatically deselect a row in JTable. Basically I have cehckbix in my jtable and my row needs to be selected or highlited when I click on checkbox. CLicking in any other column should not highlight the row.

I tries table.removeRowSelectionInterval(row,row) on clicking in cell other than checkbox it did not work.

I tried ListSelectionModelk.clearSelection() and then adding RowSelectionInterval() for rows as needed, it works but it interfere with some other functionality.

So I can't use this.

도움이 되었습니까?

해결책

As @Nizil commented that you can write your own Cell Renderer or Cell Renderer

You also need to look at How to use Tables and How to use CheckBoxes

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top