This patch (committed) improves the look of the border on the text field of an editable JComboBox under the MetalLookAndFeel:

2005-09-16  David Gilbert  <[EMAIL PROTECTED]>

        * javax/swing/plaf/metal/MetalComboBoxEditor.java
        (MetalComboBoxEditorBorder.paintBorder): modified border appearance.

You can't see this yet, because I'm still working on MetalComboBoxUI (I have it working quite well on top of Sun's BasicLookAndFeel, but it is still broken on top of Classpath's BasicLookAndFeel). I'm considering checking in my current version of MetalComboBoxUI and temporarily disabling it by changing the class name in MetalLookAndFeel.initClassDefaults(), so that perhaps someone else can get further than I can at cleaning up BasicComboBoxUI.

Regards,

Dave
Index: javax/swing/plaf/metal/MetalComboBoxEditor.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/javax/swing/plaf/metal/MetalComboBoxEditor.java,v
retrieving revision 1.1
diff -u -r1.1 MetalComboBoxEditor.java
--- javax/swing/plaf/metal/MetalComboBoxEditor.java     13 Sep 2005 21:36:03 
-0000      1.1
+++ javax/swing/plaf/metal/MetalComboBoxEditor.java     16 Sep 2005 13:51:22 
-0000
@@ -79,16 +79,19 @@
     public void paintBorder(Component c, Graphics g, int x, int y, int w, 
         int h)
     {   
+      Color savedColor = g.getColor();
       if (c.isEnabled())
-        // TODO: draw the enabled border here
-        super.paintBorder(c, g, x, y, w, h);
+        g.setColor(MetalLookAndFeel.getControlDarkShadow());  
       else
-        {
-          Color savedColor = g.getColor();
-          g.setColor(MetalLookAndFeel.getControlShadow());
-          g.drawRect(x, y, w - 1, h - 1);
-          g.setColor(savedColor);
-        }
+        g.setColor(MetalLookAndFeel.getControlShadow());
+      g.drawLine(x, y, x + w - 1, y);
+      g.drawLine(x, y, x, y + h - 2);
+      g.drawLine(x + 2, y + h - 2, x + w - 1, y + h - 2);
+      g.setColor(MetalLookAndFeel.getControl());
+      g.drawLine(x + 1, y + h - 2, x + 1, y + h - 2);
+      g.setColor(MetalLookAndFeel.getWhite());
+      g.drawLine(x, y + h - 1, x + w - 1, y + h - 1);
+      g.setColor(savedColor);
     }
 
     /**
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to