classpath-patches
[Top][All Lists]
Advanced

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

[cp-patches] FYI: Made BasicOptionPaneUI.ButtonAreaLayout class static


From: Roman Kennke
Subject: [cp-patches] FYI: Made BasicOptionPaneUI.ButtonAreaLayout class static
Date: Fri, 15 Jul 2005 17:17:46 +0200
User-agent: Mozilla Thunderbird 1.0.2 (X11/20050317)

As is required by the spec, I made the class BasicOptionPaneUI.ButtonAreaLayout class static.

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

       * javax/swing/plaf/basic/BasicOptionPaneUI.java
       (ButtonAreaLayout): Made class static.
       (ButtonAreaLayout.setSyncAllWidths): Removed revalidate(). Never
       ever revalidate something within a LayoutManager!
       (ButtonAreaLayout.setPadding): Likewise.
       (ButtonAreaLayout.setCentersChildren): Likewise.
       (ButtonAreaLayout.layoutContainer): Don't refer to enclosing
       class's instance, this is not allowed in static inner classes.

/Roman

Index: javax/swing/plaf/basic/BasicOptionPaneUI.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicOptionPaneUI.java,v
retrieving revision 1.19
diff -u -r1.19 BasicOptionPaneUI.java
--- javax/swing/plaf/basic/BasicOptionPaneUI.java       2 Jul 2005 20:32:50 
-0000       1.19
+++ javax/swing/plaf/basic/BasicOptionPaneUI.java       15 Jul 2005 15:12:28 
-0000
@@ -161,8 +161,7 @@
    *           but was made public by a compiler bug and is now
    *           public for compatibility.
    */
-  // FIXME: should be static
-  public class ButtonAreaLayout implements LayoutManager
+  public static class ButtonAreaLayout implements LayoutManager
   {
     /** Whether this layout will center the buttons. */
     protected boolean centersChildren = true;
@@ -249,7 +248,7 @@
       for (int i = 0; i < buttonList.length; i++)
         {
          Dimension dims = buttonList[i].getPreferredSize();
-         if (getSizeButtonsToSameWidth())
+         if (syncAllWidths)
            {
              buttonList[i].setBounds(x, 0, widthOfWidestButton, dims.height);
              x += widthOfWidestButton + getPadding();
@@ -347,7 +346,6 @@
     public void setCentersChildren(boolean newValue)
     {
       centersChildren = newValue;
-      optionPane.invalidate();
     }
 
     /**
@@ -358,7 +356,6 @@
     public void setPadding(int newPadding)
     {
       padding = newPadding;
-      optionPane.invalidate();
     }
 
     /**
@@ -369,7 +366,6 @@
     public void setSyncAllWidths(boolean newValue)
     {
       syncAllWidths = newValue;
-      optionPane.invalidate();
     }
   }
 

reply via email to

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