I have a JTable (having 4 columns) with selection mode set to SINGLE_SELECTION. I have set the cell renderer for last column only.
Now when i select a row in jtable, only the first 3 columns are selected, the last one is not. Please help me.
Thanks in advance....
The argument isSelected in the getTableCellRendererComponent indicates if the component is selected or not. In your code you are just re-assigning a value to it. What you need to do is change your renderer selection based on the value which you get.
In pseudo code
*Visual indication is usually achieved by tweaking the background/foreground colors, or calling a setSelected(boolean) on the renderer component
Can you provide me a demo code?
Did you check the link I had provided earlier?
Joined: May 22, 2012
When i set no cell renderer to any column, and try to select a row, all the 4 cells of row appear to be selected.
I simply can't think why only the first 3 cells of a row appear to be selected, the last cell is not selected because i set cell renderer to the last column.
No idea why this is happening and how to fix it.
@ Manish: i understand what you are saying but i can't think of a solution.