I have created my own TableCellEditor for a JTable column to do some special stuff while editing the cells of this column.
In that TableCellEditor i define a color when a cell in that column is hovered, like this :
public Component getTableCellEditorComponent(JTable table, Object value,boolean isSelected, int row, int column) {
if( isSelected ) // User clicked on this cell.
setBackground( selectedRowBG );
else if( rowIndexToHighlight == row ) // user is hovering on this cell.
setBackground( hoveredRowBG );
else // Set default cell color.
setBackground( unHoveredRowBG );
return this;
}
My problem is when i hover with the mouse on a cell in that special column the cell background color becomes "hoveredRowBG", then if i move with the mouse to a cell in another column or move to empty space in the table(That has no rows), the special cell bgColor still has the "hoveredRowBG" color. I want to remove that hovering color when such action happens.
Any ideas?