2005-07-26  Roman Kennke  <[EMAIL PROTECTED]>

        * javax/swing/plaf/basic/BasicButtonUI.java
        (paint): Only call paintFocus if the button is actually focused.
        (paintFocus): The default implementation in the BasicLookAndFeel
        does nothing. I removed the code here.

/Roman
Index: javax/swing/plaf/basic/BasicButtonUI.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicButtonUI.java,v
retrieving revision 1.22
diff -u -r1.22 BasicButtonUI.java
--- javax/swing/plaf/basic/BasicButtonUI.java   22 Jul 2005 08:36:52 -0000      
1.22
+++ javax/swing/plaf/basic/BasicButtonUI.java   26 Jul 2005 14:42:30 -0000
@@ -285,7 +285,8 @@
     paintIcon(g, c, ir);
     if (text != null)
       paintText(g, b, tr, text);
-    paintFocus(g, b, vr, tr, ir);
+    if (b.isFocusOwner())
+      paintFocus(g, b, vr, tr, ir);
   }
 
   /**
@@ -306,15 +307,8 @@
   protected void paintFocus(Graphics g, AbstractButton b, Rectangle vr,
                             Rectangle tr, Rectangle ir)
   {
-    if (b.hasFocus() && b.isFocusPainted())
-      {
-        Color saved_color = g.getColor();
-        g.setColor(focusColor);
-        Rectangle focusRect = ir.union(tr);
-        g.drawRect(focusRect.x, focusRect.y,
-                   focusRect.width, focusRect.height);
-        g.setColor(saved_color);
-      }
+    // In the BasicLookAndFeel no focus border is drawn. This can be
+    // overridden in subclasses to implement such behaviour.
   }
 
   /**
@@ -337,8 +331,8 @@
 
   /**
    * Paints the background area of an [EMAIL PROTECTED] AbstractButton} in the 
pressed
-   * state.  This means filling the supplied area with the 
-   * <code>pressedBackgroundColor</code>.
+   * state.  This means filling the supplied area with the [EMAIL PROTECTED]
+   * pressedBackgroundColor}.
    *
    * @param g The graphics context to paint with
    * @param b The button to paint the state of
@@ -374,7 +368,7 @@
     
   /**
    * Paints the "text" property of an [EMAIL PROTECTED] AbstractButton}, using 
the
-   * <code>textColor</code> color.
+   * [EMAIL PROTECTED] textColor} color.
    *
    * @param g The graphics context to paint with
    * @param c The component to paint the state of
@@ -389,7 +383,7 @@
 
   /**
    * Paints the "text" property of an [EMAIL PROTECTED] AbstractButton}, using 
the
-   * <code>textColor</code> color.
+   * [EMAIL PROTECTED] textColor} color.
    *
    * @param g The graphics context to paint with
    * @param b The button to paint the state of
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to