How to make the background of a JTable transparent?

java, jtable, swing, transparent

Solution

The table will be transparent if neither itself nor the cells are opaque:

table.setOpaque(false);
((DefaultTableCellRenderer)table.getDefaultRenderer(Object.class)).setOpaque(false);

If the table is in a `ScrollPane`, it is to make transparent as well:

scrollPane.setOpaque(false);
scrollPane.getViewport().setOpaque(false);

At least, you can remove the grid lines:

table.setShowGrid(false);

Quite a big work for a simply result...

Problem

Possible Duplicate: Java swing Table transparency It is not so easy to make a JTable background transparent. I want to see only the text content of my cells.

Original source

Related problems