In my Java 7 application I use a Swing JTable
with two columns. The left column uses a DefaultTableCellRenderer
where the setHorizontalAlignment()
is set to centered, whereas the right column uses no specific renderer.
That right column shows each table row in alternating colors by default, which is not the case on the left column with the renderer used. Moreover, when I hover with the mouse over the rows on the right column, then the row under the mouse curser is highlighted when focused, which also isn't the case with the left column.
Is there any (easy) way of mimic the default behaviour of the row rendering (i.e. the alternating colors and the highlighted row) when using a DefaultTableCellRenderer
?
PS: I am using the Substance L&F.
Substance
has ownRenderer
s, you should changeXxxXxxRenderer
by addSubstance
before, e.g.SubstanceDefaultTableCellRenderer
instead ofDefaultTableCellRenderer
, the same forJComboBox
,JList
,JTree
orJTableHeader