문제

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.

도움이 되었습니까?

해결책

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?

Substance has own Renderers, you should change XxxXxxRenderer by add Substance before, e.g. SubstanceDefaultTableCellRenderer instead of DefaultTableCellRenderer, the same for JComboBox, JList, JTree or JTableHeader

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top