This fixes the border of the metal combobox editor.

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

        * javax/swing/plaf/metal/MetalComboBoxEditor.java
        (MetalComboBoxEditorBorder): Made this a subclass of
AbstractBorder
        instead of Flush3DBorder.
        (paintBorder): Fixed border painting.
        (editorBorderInsets): Fixed border's insets.

/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.5
diff -u -u -1 -0 -r1.5 MetalComboBoxEditor.java
--- javax/swing/plaf/metal/MetalComboBoxEditor.java	7 Nov 2005 16:59:06 -0000	1.5
+++ javax/swing/plaf/metal/MetalComboBoxEditor.java	17 Mar 2006 21:21:17 -0000
@@ -31,39 +31,38 @@
 independent module, the terms and conditions of the license of that
 module.  An independent module is a module which is not derived from
 or based on this library.  If you modify this library, you may extend
 this exception to your version of the library, but you are not
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
 
 
 package javax.swing.plaf.metal;
 
-import java.awt.Color;
 import java.awt.Component;
 import java.awt.Graphics;
 import java.awt.Insets;
 
 import javax.swing.JTextField;
+import javax.swing.border.AbstractBorder;
 import javax.swing.plaf.basic.BasicComboBoxEditor;
 import javax.swing.plaf.metal.MetalLookAndFeel;
-import javax.swing.plaf.metal.MetalBorders.Flush3DBorder;
 
 /**
  * An editor used by the [EMAIL PROTECTED] MetalComboBoxUI} class.
  */
 public class MetalComboBoxEditor extends BasicComboBoxEditor
 {
   /**
    * A border used for the [EMAIL PROTECTED] JTextField} component.
    */
-  static class MetalComboBoxEditorBorder extends Flush3DBorder
+  static class MetalComboBoxEditorBorder extends AbstractBorder
   {
     /**
      * Creates a new border instance.
      */
     public MetalComboBoxEditorBorder()
     {
       // Nothing to do here.
     }
     
     /**
@@ -71,34 +70,33 @@
      * 
      * @param c  the component (ignored).
      * @param g  the graphics device.
      * @param x  the x-coordinate.
      * @param y  the y-coordinate.
      * @param w  the width.
      * @param h  the height.
      */
     public void paintBorder(Component c, Graphics g, int x, int y, int w, 
         int h)
-    {   
-      Color savedColor = g.getColor();
-      if (c.isEnabled())
-        g.setColor(MetalLookAndFeel.getControlDarkShadow());  
-      else
-        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.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(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);
+      g.drawLine(1, h - 2, 1, h - 2);
+      g.translate(-x, -y);
     }
 
     /**
      * Measures the width of this border.
      *
      * @param c the component whose border is to be measured.
      *
      * @return an Insets object whose <code>left</code>, <code>right</code>,
      *         <code>top</code> and <code>bottom</code> fields indicate the
      *         width of the border at the respective edge, which is zero
@@ -122,21 +120,21 @@
     /**
      * Creates a new instance.
      */
     public UIResource()
     {
       // Nothing to do here.
     }
   }
   
   /** The editor's border insets. */
-  protected static Insets editorBorderInsets = new Insets(4, 2, 4, 0);
+  protected static Insets editorBorderInsets = new Insets(2, 2, 2, 0);
   
   /**
    * Creates a new editor.
    */
   public MetalComboBoxEditor()
   {
     super();
     editor.setBorder(new MetalComboBoxEditorBorder());
   }
   

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

Reply via email to