A simple TableCellRenderer is used to demonstrate how to add left/right padding to the table cells and alternate rows background color.

The trick is to use an EmptyBorder which adds some additional space. Background color is alternately changed as long as the cell is not selected.

In this example another header rendering technique is used as in the headerReanderer example. Instead of using the default header renderer we emulate the default style by painting grid with a MatteBorder and setting font and foreground color.

All relevant lines are highlighted. Press the "Run..." button to start the example.