6882917: Nimbus and DefaultTableCellRenderer: must start with normal background
authorpeterz
Wed, 18 Nov 2009 17:36:46 +0300
changeset 4283 06d5378aaff3
parent 4282 ac32f2a927e0
child 4284 12d5126755c0
child 4378 ef21a120cb18
6882917: Nimbus and DefaultTableCellRenderer: must start with normal background Reviewed-by: rupashka
jdk/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java
jdk/src/share/classes/javax/swing/table/DefaultTableCellRenderer.java
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java	Wed Nov 18 12:58:02 2009 +0300
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java	Wed Nov 18 17:36:46 2009 +0300
@@ -638,7 +638,7 @@
             if ((b == null || b instanceof UIResource
                     || component instanceof SynthBooleanTableCellRenderer)
                     && !table.isCellSelected(row, column)) {
-                if (alternateColor != null && row % 2 == 0) {
+                if (alternateColor != null && row % 2 != 0) {
                     component.setBackground(alternateColor);
                 }
             }
--- a/jdk/src/share/classes/javax/swing/table/DefaultTableCellRenderer.java	Wed Nov 18 12:58:02 2009 +0300
+++ b/jdk/src/share/classes/javax/swing/table/DefaultTableCellRenderer.java	Wed Nov 18 17:36:46 2009 +0300
@@ -214,8 +214,9 @@
                                     : table.getBackground();
             if (background == null || background instanceof javax.swing.plaf.UIResource) {
                 Color alternateColor = DefaultLookup.getColor(this, ui, "Table.alternateRowColor");
-                if (alternateColor != null && row % 2 == 0)
+                if (alternateColor != null && row % 2 != 0) {
                     background = alternateColor;
+                }
             }
             super.setForeground(unselectedForeground != null
                                     ? unselectedForeground