classpath-patches
[Top][All Lists]
Advanced

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

[cp-patches] FYI: fixlet for BasicButtonUI


From: Roman Kennke
Subject: [cp-patches] FYI: fixlet for BasicButtonUI
Date: Tue, 26 Jul 2005 16:46:26 +0200
User-agent: Mozilla Thunderbird 1.0.2 (X11/20050317)

2005-07-26  Roman Kennke  <address@hidden>

        * 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 address@hidden 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 address@hidden
+   * 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 address@hidden AbstractButton}, using the
-   * <code>textColor</code> color.
+   * address@hidden 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 address@hidden AbstractButton}, using the
-   * <code>textColor</code> color.
+   * address@hidden textColor} color.
    *
    * @param g The graphics context to paint with
    * @param b The button to paint the state of

reply via email to

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