classpath-patches
[Top][All Lists]
Advanced

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

[cp-patches] FYI: Improved javax.swing.plaf.basic.BasicScrollBarUI


From: Roman Kennke
Subject: [cp-patches] FYI: Improved javax.swing.plaf.basic.BasicScrollBarUI
Date: Wed, 27 Apr 2005 12:17:23 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021204

Hi,

I slightly improved the UI of JScrollBar. It now looks more like it should in the Basic L&F.

2005-04-27  Roman Kennke  <address@hidden>

       * javax/swing/plaf/basic/BasicScrollBarUI.java
       (configureScrollBarColors: Changed key 'ScrollBar.thumbLightShadow'
       to 'ScrollBar.thumbShadow'. The formes does not exist.
       (paintThumb): Use BasicGraphicsUtils for painting the thumb.


/Roman

Index: javax/swing/plaf/basic/BasicScrollBarUI.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicScrollBarUI.java,v
retrieving revision 1.17
diff -u -r1.17 BasicScrollBarUI.java
--- javax/swing/plaf/basic/BasicScrollBarUI.java        26 Apr 2005 18:56:19 
-0000      1.17
+++ javax/swing/plaf/basic/BasicScrollBarUI.java        27 Apr 2005 10:12:19 
-0000
@@ -499,7 +499,7 @@
     thumbColor = defaults.getColor("ScrollBar.thumb");
     thumbHighlightColor = defaults.getColor("ScrollBar.thumbHighlight");
     thumbDarkShadowColor = defaults.getColor("ScrollBar.thumbDarkShadow");
-    thumbLightShadowColor = defaults.getColor("ScrollBar.thumbLightShadow");
+    thumbLightShadowColor = defaults.getColor("ScrollBar.thumbShadow");
   }
 
   /**
@@ -1034,53 +1034,15 @@
    */
   protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds)
   {
-    Color saved = g.getColor();
-    Point x;
-    Point y;
-    Point z;
-    Polygon lines;
-
-    g.setColor(thumbHighlightColor);
-    x = new Point(thumbBounds.x + 1, thumbBounds.y + 1);
-    y = new Point(x);
-    y.translate(thumbBounds.width - 2, 0);
-    z = new Point(x);
-    z.translate(0, thumbBounds.height - 2);
-
-    lines = new Polygon(new int[] { x.x, y.x, z.x },
-                        new int[] { x.y, y.y, z.y }, 3);
-
-    g.drawPolygon(lines);
-
-    g.setColor(thumbLightShadowColor);
-    x = new Point(thumbBounds.x + thumbBounds.width - 1,
-                  thumbBounds.y + thumbBounds.height - 1);
-    y = new Point(x);
-    y.translate(-(thumbBounds.width - 2), 0);
-    z = new Point(x);
-    z.translate(0, -(thumbBounds.height - 2));
-
-    lines = new Polygon(new int[] { x.x, y.x, z.x },
-                        new int[] { x.y, y.y, z.y }, 3);
-    g.drawPolygon(lines);
-
-    g.setColor(thumbDarkShadowColor);
-    x = new Point(thumbBounds.x + thumbBounds.width,
-                  thumbBounds.y + thumbBounds.height);
-    y = new Point(x);
-    y.translate(-thumbBounds.width, 0);
-    z = new Point(x);
-    z.translate(0, -thumbBounds.height);
-
-    lines = new Polygon(new int[] { x.x, y.x, z.x },
-                        new int[] { x.y, y.y, z.y }, 3);
-    g.drawPolygon(lines);
-
     g.setColor(thumbColor);
     g.fillRect(thumbBounds.x, thumbBounds.y, thumbBounds.width,
                thumbBounds.height);
 
-    g.setColor(saved);
+    BasicGraphicsUtils.drawBezel(g, thumbBounds.x, thumbBounds.y,
+                                 thumbBounds.width, thumbBounds.height,
+                                 false, false, thumbDarkShadowColor,
+                                 thumbDarkShadowColor, thumbHighlightColor,
+                                 thumbHighlightColor);
   }
 
   /**

reply via email to

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