I also have a bitmap in the panel "behind" the table (table is non-opaque).
Everything about the table is transparent as I expected, except the header
row. No matter what combination of setOpaque() and setBackground() calls I
make, even with transparent colors, it still insists on drawing a light gray
background for the header row.
Here's the code that sets the background colors right now:
// Set the background of the scroll view that contains the table
searchResultsScrollPane.getViewport().setBackground(new
Color(0,0,0,0));
searchResultsScrollPane.getViewport().setOpaque(false);
// Set the background of the table
searchResultsTable.setOpaque(false);
searchResultsTable.setSelectionBackground(new Color(211,202,178));
searchResultsTable.setSelectionForeground(Color.black);
searchResultsTable.setBackground(new Color(0,0,0,0));
In the table itself, I can "see through" to the background properly, but not
in the table header row.
Any ideas?
Thanks,
Ken Carpenter
> I have a JTable with a custom renderer for the header row. I basically just
> draw a JLabel with an image in it for each column.
[Header is not transparent]
Untested: table.getTableHeader().setOpaque(false);
scrollPane.getColumnHeader().setOpaque(false);
This seems to work.
Christian