classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] FYI: BasicComboBoxUI


From: David Gilbert
Subject: [cp-patches] FYI: BasicComboBoxUI
Date: Tue, 13 Sep 2005 22:11:49 +0000
User-agent: Mozilla Thunderbird 1.0.6 (X11/20050728)

I committed this patch:

2005-09-13  David Gilbert  <address@hidden>

        * javax/swing/plaf/basic/BasicComboBoxUI.java
        (lightHighlight): removed,
        (installDefaults): only update component attributes if they are tagged
        with UIResource, initialise button colors from correct defaults,
        (uninstallDefaults): only clear attributes that are tagged with
        UIResource.

Regards,

Dave Gilbert
Index: javax/swing/plaf/basic/BasicComboBoxUI.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicComboBoxUI.java,v
retrieving revision 1.10
diff -u -r1.10 BasicComboBoxUI.java
--- javax/swing/plaf/basic/BasicComboBoxUI.java 9 Sep 2005 04:17:15 -0000       
1.10
+++ javax/swing/plaf/basic/BasicComboBoxUI.java 13 Sep 2005 20:56:49 -0000
@@ -75,6 +75,7 @@
 import javax.swing.event.ListDataListener;
 import javax.swing.plaf.ComboBoxUI;
 import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.UIResource;
 
 /**
  * UI Delegate for JComboBox
@@ -158,7 +159,6 @@
   private Color shadow;
   private Color darkShadow;
   private Color highlight;
-  private Color lightHighlight;
 
   /* Size of the largest item in the comboBox
    * This is package-private to avoid an accessor method.
@@ -245,16 +245,19 @@
   {
     UIDefaults defaults = UIManager.getLookAndFeelDefaults();
 
-    comboBox.setBackground(defaults.getColor("ComboBox.background"));
-    comboBox.setFont(defaults.getFont("ComboBox.font"));
-    comboBox.setForeground(defaults.getColor("ComboBox.foreground"));
-
-    // Set default color that should be used to to render selected item
-    // of the combo box.
-    shadow = defaults.getColor("Button.shadow");
-    darkShadow = defaults.getColor("Button.darkShadow");
-    lightHighlight = defaults.getColor("Button.light");
-    highlight = defaults.getColor("Button.highlight");
+    if (comboBox.getFont() instanceof UIResource)
+      comboBox.setFont(defaults.getFont("ComboBox.font"));
+    
+    if (comboBox.getForeground() instanceof UIResource)
+      comboBox.setForeground(defaults.getColor("ComboBox.foreground"));
+
+    if (comboBox.getBackground() instanceof UIResource)
+      comboBox.setBackground(defaults.getColor("ComboBox.background"));
+
+    // fetch the button color scheme
+    shadow = defaults.getColor("ComboBox.buttonShadow");
+    darkShadow = defaults.getColor("ComboBox.buttonDarkShadow");
+    highlight = defaults.getColor("ComboBox.buttonHighlight");
   }
 
   /**
@@ -291,15 +294,17 @@
    */
   protected void uninstallDefaults()
   {
-    UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+    if (comboBox.getFont() instanceof UIResource)
+      comboBox.setFont(null);
 
-    comboBox.setBackground(null);
-    comboBox.setFont(null);
-    comboBox.setForeground(null);
+    if (comboBox.getForeground() instanceof UIResource)
+      comboBox.setForeground(null);
+    
+    if (comboBox.getBackground() instanceof UIResource)
+      comboBox.setBackground(null);
 
     shadow = null;
     darkShadow = null;
-    lightHighlight = null;
     highlight = null;
   }
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]