JTable: How to set row background color when using intercell spacing?
843806Apr 8 2009 — edited Apr 8 2009My application needs to set some rows to have black text on a colored background (reverse video). So I created a custom cell renderer that handles that for me. Works great. I can set the fg/bg colors on the JLabel based on the table data.
I wanted a little more space around the data though, so I added some margin/padding using table.setIntercellSpacing(). I get the spacing I wanted, but the padding is using the table background color (black), not the cell component background color. So my row looks like a set of distinct colored rectangles, rather one long rectangle.
What am I missing to get the row background color set? Or should I use a different method to add space around the cell text?