The JComboBox used to look a little strange in the OceanTheme. The
editor box didn't seem to fit right with the button. I suspected
something strange with the layout, but it turned out that the layout was
right, only the painting of the editor border was not suitable for the
OceanTheme. This patch fixes this.

2006-03-17  Roman Kennke  <[EMAIL PROTECTED]>

        * javax/swing/plaf/metal/MetalComboBoxEditor.java
        (MetalComboBoxEditorBorder.paintBorder): Implemented special
        border painting for the Ocean theme.
        (MetalComboBoxEditor): Create editor directly instead of going
        to super.

/Roman

-- 
“Improvement makes straight roads, but the crooked roads, without
Improvement, are roads of Genius.” - William Blake
Index: javax/swing/plaf/metal/MetalComboBoxEditor.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/metal/MetalComboBoxEditor.java,v
retrieving revision 1.6
diff -u -r1.6 MetalComboBoxEditor.java
--- javax/swing/plaf/metal/MetalComboBoxEditor.java	17 Mar 2006 21:22:59 -0000	1.6
+++ javax/swing/plaf/metal/MetalComboBoxEditor.java	17 Mar 2006 22:59:58 -0000
@@ -79,16 +79,31 @@
         int h)
     {
       g.translate(x, y);
-      g.setColor(MetalLookAndFeel.getControlDarkShadow());
-      g.drawLine(0, 0, w - 1, 0);
-      g.drawLine(0, 0, 0, h - 2);
-      g.drawLine(0, h - 2, w - 1, h - 2);
-      g.setColor(MetalLookAndFeel.getControlHighlight());
-      g.drawLine(1, 1, w - 1, 1);
-      g.drawLine(1, 1, 1, h - 1);
-      g.drawLine(1, h - 1, w - 1, h - 1);
-      g.setColor(MetalLookAndFeel.getControl());
-      g.drawLine(1, h - 2, 1, h - 2);
+      if (MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme)
+        {
+          g.setColor(MetalLookAndFeel.getControlDarkShadow());
+          g.drawLine(0, 0, w - 1, 0);
+          g.drawLine(0, 0, 0, h - 1);
+          g.drawLine(0, h - 1, w - 1, h - 1);
+          g.setColor(MetalLookAndFeel.getControlShadow());
+          g.drawLine(1, 1, w - 2, 1);
+          g.drawLine(1, 1, 1, h - 2);
+          g.drawLine(1, h - 2, w - 1, h - 2);
+          g.drawLine(w - 1, 1, w - 1, h - 2);
+        }
+      else
+        {
+          g.setColor(MetalLookAndFeel.getControlDarkShadow());
+          g.drawLine(0, 0, w - 1, 0);
+          g.drawLine(0, 0, 0, h - 2);
+          g.drawLine(0, h - 2, w - 1, h - 2);
+          g.setColor(MetalLookAndFeel.getControlHighlight());
+          g.drawLine(1, 1, w - 1, 1);
+          g.drawLine(1, 1, 1, h - 1);
+          g.drawLine(1, h - 1, w - 1, h - 1);
+          g.setColor(MetalLookAndFeel.getControl());
+          g.drawLine(1, h - 2, 1, h - 2);
+        }
       g.translate(-x, -y);
     }
 
@@ -134,7 +149,7 @@
    */
   public MetalComboBoxEditor()
   {
-    super();
+    editor = new JTextField("", 9);
     editor.setBorder(new MetalComboBoxEditorBorder());
   }
   

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil

Reply via email to