Question

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.

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top