harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r504144 - /harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/colorchooser/SwatchesPanel.java
Date Tue, 06 Feb 2007 14:15:01 GMT
Author: apetrenko
Date: Tue Feb  6 06:15:00 2007
New Revision: 504144

URL: http://svn.apache.org/viewvc?view=rev&rev=504144
Log:
Patch for HARMONY-2711 "[classlib][swing] j.s.JColorChooser should use "ColorChooser.swatchesDefaultRecentColor"
L&F key"

Modified:
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/colorchooser/SwatchesPanel.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/colorchooser/SwatchesPanel.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/colorchooser/SwatchesPanel.java?view=diff&rev=504144&r1=504143&r2=504144
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/colorchooser/SwatchesPanel.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/colorchooser/SwatchesPanel.java
Tue Feb  6 06:15:00 2007
@@ -26,6 +26,8 @@
 import java.awt.Graphics;
 import java.awt.event.MouseEvent;
 
+import java.util.Arrays;
+
 import javax.swing.Icon;
 import javax.swing.JLabel;
 import javax.swing.JPanel;
@@ -132,8 +134,8 @@
         recentSwatchSize = UIManager.getDimension("ColorChooser.swatchesRecentSwatchSize");
 
         JPanel right = new JPanel(new BorderLayout());
-        recentPanel = new SwatchPanel(new Color[RECENT_SWATCH_WIDTH][RECENT_SWATCH_HEIGHT],
-                                                  null, recentSwatchSize);
+        recentPanel = new SwatchPanel(createRecentColors(), null, recentSwatchSize);
+        
         right.add(BorderLayout.CENTER, new JLabel(UIManager.getString("ColorChooser.swatchesRecentText")));
         right.add(BorderLayout.SOUTH, recentPanel);
 
@@ -173,6 +175,16 @@
                                                  1.f, 1.5f * (colors[i].length - j + .3f)
/ (colors[i].length - 1));
             }
         }
+        return colors;
+    }
+
+    private static Color[][] createRecentColors() {
+        final Color[][] colors = new Color[RECENT_SWATCH_WIDTH][RECENT_SWATCH_HEIGHT];
+        final Object propertyValue = UIManager.get("ColorChooser.swatchesDefaultRecentColor");
+        final Color defaultColor = propertyValue instanceof Color ? (Color)propertyValue
: Color.BLACK;
+        for (Color[] cols : colors)
+            Arrays.fill(cols, defaultColor);
+            
         return colors;
     }
 }



Mime
View raw message