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
Try this:
jtable.setCellSelectionEnabled(true);
Then in the getTableCellRendererComponent
if (table.isCellSelected(row, column))
setForeground(Color.red);
else if (table.isRowSelected(row))
setForeground(Color.green);
else if (table.isColumnSelected(column))
setForeground(Color.blue);
else
setForeground(Color.black);
That will render the selected cell in red, the rest of the row in green, and the rest of the column in blue. Note: cell selection requires the selection model be single, other selection models may cause unpredictable behaviors.