I have a basic swing JTable and the requirement is that when clicked on any cell, the entire row should be highlighted, and also that the cell which was clicked should be a
But that did not seem to work (entire row was highlighted in red).
You need to check the "hasFocus" variable, not the "isSelected" variable.
Another option instead of creating mulutiple custom renderers (in case you table has columns of different class types) is to use the Table Row Renderering approach.