classpath-patches
[Top][All Lists]
Advanced

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

[cp-patches] FYI: BasicComboBoxUI fixlets


From: David Gilbert
Subject: [cp-patches] FYI: BasicComboBoxUI fixlets
Date: Tue, 18 Oct 2005 12:08:38 +0100
User-agent: Mozilla Thunderbird 1.0.6 (X11/20050728)

I committed this patch to fix a couple of very minor issues in the BasicComboBoxUI class: the button colors are now fetched from the UIDefaults, and the createEditor() method returns an editor that implements UIResource:

2005-10-18  David Gilbert  <address@hidden>

        * javax/swing/plaf/basic/BasicComboBoxUI.java
        (buttonBackground): new field,
        (shadow): renamed buttonShadow,
        (darkShadow): renamed buttonDarkShadow,
        (highlight): renamed buttonHighlight,
        (installDefaults): initialise buttonBackground, plus updates for
        renamed fields,
        (uninstallDefaults): clear buttonBackground, plus updates for renamed
        fields,
        (createEditor): return subclass that implements UIResource,
        (createArrowButton): use constructor that accepts colors,
        (getMaximumSize): fix API doc error,
        * javax/swing/plaf/basic/BasicLookAndFeel.java
        (initComponentDefaults): correct 'ComboBox.buttonDarkShadow' default.

Regards,

Dave
Index: javax/swing/plaf/basic/BasicComboBoxUI.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicComboBoxUI.java,v
retrieving revision 1.23
diff -u -r1.23 BasicComboBoxUI.java
--- javax/swing/plaf/basic/BasicComboBoxUI.java 17 Oct 2005 16:17:45 -0000      
1.23
+++ javax/swing/plaf/basic/BasicComboBoxUI.java 18 Oct 2005 11:03:31 -0000
@@ -157,12 +157,29 @@
    */
   protected PropertyChangeListener propertyChangeListener;
 
+  /** 
+   * The button background. 
+   * @see #installDefaults()
+   */
+  private Color buttonBackground;
+  
+  /** 
+   * The button shadow. 
+   * @see #installDefaults()
+   */
+  private Color buttonShadow;
+  
   /**
-   * Colors that are used to render selected item in the combo box.
+   * The button dark shadow.
+   * @see #installDefaults()
    */
-  private Color shadow;
-  private Color darkShadow;
-  private Color highlight;
+  private Color buttonDarkShadow;
+
+  /**
+   * The button highlight.
+   * @see #installDefaults()
+   */
+  private Color buttonHighlight;
 
   /* Size of the largest item in the comboBox
    * This is package-private to avoid an accessor method.
@@ -244,10 +261,12 @@
   {
     LookAndFeel.installColorsAndFont(comboBox, "ComboBox.background",
                                      "ComboBox.foreground", "ComboBox.font");
+    
     // fetch the button color scheme
-    shadow = UIManager.getColor("ComboBox.buttonShadow");
-    darkShadow = UIManager.getColor("ComboBox.buttonDarkShadow");
-    highlight = UIManager.getColor("ComboBox.buttonHighlight");
+    buttonBackground = UIManager.getColor("ComboBox.buttonBackground");
+    buttonShadow = UIManager.getColor("ComboBox.buttonShadow");
+    buttonDarkShadow = UIManager.getColor("ComboBox.buttonDarkShadow");
+    buttonHighlight = UIManager.getColor("ComboBox.buttonHighlight");
   }
 
   /**
@@ -295,9 +314,10 @@
     if (comboBox.getBackground() instanceof UIResource)
       comboBox.setBackground(null);
 
-    shadow = null;
-    darkShadow = null;
-    highlight = null;
+    buttonBackground = null;
+    buttonShadow = null;
+    buttonDarkShadow = null;
+    buttonHighlight = null;
   }
 
   /**
@@ -432,7 +452,7 @@
    */
   protected ComboBoxEditor createEditor()
   {
-    return new BasicComboBoxEditor();
+    return new BasicComboBoxEditor.UIResource();
   }
 
   /**
@@ -551,7 +571,8 @@
    */
   protected JButton createArrowButton()
   {
-    return new BasicArrowButton(BasicArrowButton.SOUTH);
+    return new BasicArrowButton(BasicArrowButton.SOUTH, buttonBackground, 
+            buttonShadow, buttonDarkShadow, buttonHighlight);
   }
 
   /**
@@ -649,7 +670,7 @@
    *
    * @param c The address@hidden JComponent} to find the maximum size for
    *
-   * @return The dimensions of the minimum size.
+   * @return The maximum size (<code>Dimension(32767, 32767)</code>).
    */
   public Dimension getMaximumSize(JComponent c)
   {
Index: javax/swing/plaf/basic/BasicLookAndFeel.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicLookAndFeel.java,v
retrieving revision 1.61
diff -u -r1.61 BasicLookAndFeel.java
--- javax/swing/plaf/basic/BasicLookAndFeel.java        17 Oct 2005 19:08:23 
-0000      1.61
+++ javax/swing/plaf/basic/BasicLookAndFeel.java        18 Oct 2005 11:03:34 
-0000
@@ -364,7 +364,7 @@
       }),
       "ComboBox.background", new ColorUIResource(Color.white),
       "ComboBox.buttonBackground", new ColorUIResource(light),
-      "ComboBox.buttonDarkShadow", new ColorUIResource(shadow),
+      "ComboBox.buttonDarkShadow", new ColorUIResource(darkShadow),
       "ComboBox.buttonHighlight", new ColorUIResource(highLight),
       "ComboBox.buttonShadow", new ColorUIResource(shadow),
       "ComboBox.disabledBackground", new ColorUIResource(light),

reply via email to

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