• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to allow a cell selection for only one column

su ferrente
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I wonder if anyone can tell me if it is possible to select a cell from one particular column. This is what I want to do:

I have a couple of cloumns and I only want the user to be able to select a cell from the first column only. I have enabled rowSelectionAllowed() , columnSelectionAllowed and also cellSelectionAllowed. This allows me to select a cell.

I thought perhaps I should rewrite isCellSelected() so only the cell in first column should be selected.
Here is my code:

What I am getting is when I select a cell in first column, it selected all the rows! I just want the selected cell to be highlighted.

I have read everything I can find on JTable but I can't find any solution. Any idea will be much appreciated.

Thanks in advance.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic