I rewrote ScrollPaneLayout.minimumLayoutSize() to make the mauve tests
pass for this method.

2006-01-29  Roman Kennke  <[EMAIL PROTECTED]>

        * javax/swing/ScrollPaneLayout.java
        (minimumLayoutSize): Rewritten to match JDKs behaviour.

/Roman
Index: javax/swing/ScrollPaneLayout.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/ScrollPaneLayout.java,v
retrieving revision 1.20
diff -u -r1.20 ScrollPaneLayout.java
--- javax/swing/ScrollPaneLayout.java	27 Oct 2005 18:56:51 -0000	1.20
+++ javax/swing/ScrollPaneLayout.java	29 Jan 2006 19:07:44 -0000
@@ -285,20 +285,20 @@
     // Sun's implementation simply throws a ClassCastException if
     // parent is no JScrollPane, so do we.
     JScrollPane sc = (JScrollPane) parent;
-    Dimension viewportSize = viewport.getMinimumSize();
-    int width = viewportSize.width;
-    int height = viewportSize.height;
-    if (hsb != null && hsb.isVisible())
-      height += hsb.getMinimumSize().height;
-    if (vsb != null && vsb.isVisible())
-      width += vsb.getMinimumSize().width;
-    if (rowHead != null && rowHead.isVisible())
-      width += rowHead.getMinimumSize().width;
-    if (colHead != null && colHead.isVisible())
-      height += colHead.getMinimumSize().height;
     Insets i = sc.getInsets();
-    return new Dimension(width + i.left + i.right,
-                         height + i.top + i.bottom);
+    Dimension viewportMinSize = sc.getViewport().getMinimumSize();
+
+    int width = i.left + i.right + viewportMinSize.width;
+    if (sc.getVerticalScrollBarPolicy()
+        != JScrollPane.VERTICAL_SCROLLBAR_NEVER)
+      width += sc.getVerticalScrollBar().getMinimumSize().width;
+
+    int height = i.top + i.bottom + viewportMinSize.height;
+    if (sc.getHorizontalScrollBarPolicy()
+        != JScrollPane.HORIZONTAL_SCROLLBAR_NEVER)
+      height += sc.getHorizontalScrollBar().getMinimumSize().height;
+
+    return new Dimension(width, height);
   }
 
   /**

Reply via email to