This patch (committed) moves the initialisation of the scrollBarWidth field into the installDefaults() method - the JGoodies PlasticLookAndFeel class requires this, and it seems more sensible than the code that we have now in any case:

2006-09-07  David Gilbert  <[EMAIL PROTECTED]>

        * javax/swing/plaf/metal/MetalScrollBarUI.java
        (installDefaults): Initialise scrollBarWidth from UI defaults here,
        (createDecreaseButton): Don't fetch scrollBarWidth here,
        (createIncreaseButton): Likewise.

Regards,

Dave
Index: javax/swing/plaf/metal/MetalScrollBarUI.java
===================================================================
RCS file: 
/sources/classpath/classpath/javax/swing/plaf/metal/MetalScrollBarUI.java,v
retrieving revision 1.15
diff -u -r1.15 MetalScrollBarUI.java
--- javax/swing/plaf/metal/MetalScrollBarUI.java        11 May 2006 17:05:55 
-0000      1.15
+++ javax/swing/plaf/metal/MetalScrollBarUI.java        7 Sep 2006 09:33:16 
-0000
@@ -1,5 +1,5 @@
 /* MetalScrollBarUI.java
-   Copyright (C) 2005 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2006, Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -169,6 +169,7 @@
     Boolean prop = (Boolean) scrollbar.getClientProperty(FREE_STANDING_PROP);
     isFreeStanding = prop == null ? true : prop.booleanValue();
     scrollBarShadowColor = UIManager.getColor("ScrollBar.shadow");
+    scrollBarWidth = UIManager.getInt("ScrollBar.width");
     super.installDefaults();
   }
     
@@ -187,7 +188,10 @@
   
   /**
    * Creates a new button to use as the control at the lower end of the
-   * [EMAIL PROTECTED] JScrollBar}.
+   * [EMAIL PROTECTED] JScrollBar}.  This method assigns the new button (an 
instance of
+   * [EMAIL PROTECTED] MetalScrollButton} to the [EMAIL PROTECTED] 
#decreaseButton} field, and also 
+   * returns the button.  The button width is determined by the 
+   * <code>ScrollBar.width</code> setting in the UI defaults.
    * 
    * @param orientation  the orientation of the button ([EMAIL PROTECTED] 
#NORTH},
    *                     [EMAIL PROTECTED] #SOUTH}, [EMAIL PROTECTED] #EAST} 
or [EMAIL PROTECTED] #WEST}).
@@ -196,7 +200,6 @@
    */
   protected JButton createDecreaseButton(int orientation)
   {
-    scrollBarWidth = UIManager.getInt("ScrollBar.width");
     decreaseButton = new MetalScrollButton(orientation, scrollBarWidth, 
             isFreeStanding);
     return decreaseButton;
@@ -204,7 +207,10 @@
 
   /**
    * Creates a new button to use as the control at the upper end of the
-   * [EMAIL PROTECTED] JScrollBar}.
+   * [EMAIL PROTECTED] JScrollBar}.  This method assigns the new button (an 
instance of
+   * [EMAIL PROTECTED] MetalScrollButton} to the [EMAIL PROTECTED] 
#increaseButton} field, and also 
+   * returns the button.  The button width is determined by the 
+   * <code>ScrollBar.width</code> setting in the UI defaults.
    * 
    * @param orientation  the orientation of the button ([EMAIL PROTECTED] 
#NORTH},
    *                     [EMAIL PROTECTED] #SOUTH}, [EMAIL PROTECTED] #EAST} 
or [EMAIL PROTECTED] #WEST}).
@@ -213,7 +219,6 @@
    */
   protected JButton createIncreaseButton(int orientation)
   {
-    scrollBarWidth = UIManager.getInt("ScrollBar.width");
     increaseButton = new MetalScrollButton(orientation, scrollBarWidth, 
             isFreeStanding);
     return increaseButton;

Reply via email to