This patch to ViewportLayout reverts part of a patch committed on
October 12 that I mentioned on IRC was incorrect.  We should be checking
to see if the viewport is smaller than the minimum size of the view, not
the preferred size.  Being smaller than the preferred size is allowed.

This fixes PR 17362 and also makes many test apps look a lot better as
the scrollbars show up when they're supposed to, rather than after a
resize.  

2005-10-26  Anthony Balkissoon  <[EMAIL PROTECTED]>

        * javax/swing/ViewportLayout.java:
        (layoutContainer): Fixed incorrect boundary checks, should have been 
        checking for viewport being  smaller than minimum size, not smaller 
        than preferred size.

--Tony
Index: javax/swing/ViewportLayout.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/ViewportLayout.java,v
retrieving revision 1.17
diff -u -r1.17 ViewportLayout.java
--- javax/swing/ViewportLayout.java	19 Oct 2005 15:45:05 -0000	1.17
+++ javax/swing/ViewportLayout.java	26 Oct 2005 19:34:19 -0000
@@ -145,7 +145,7 @@
                                      portBounds.y + portBounds.height);
         
     // vertical implementation of the above rules
-    if (portBounds.height >= viewPref.height)
+    if (portBounds.height >= viewMinimum.height)
       {
         portBounds.y = 0;
         if ( !(view instanceof Scrollable) || ((Scrollable)view).getScrollableTracksViewportHeight())
@@ -153,13 +153,14 @@
       }
     else
       {
+        viewPref.height = viewMinimum.height;
         int overextension = portLowerRight.y - viewPref.height;
         if (overextension > 0)
             portBounds.y -= overextension;
       }
 
     // horizontal implementation of the above rules
-    if (portBounds.width >= viewPref.width)
+    if (portBounds.width >= viewMinimum.width)
       {
         portBounds.x = 0;
         if ( !(view instanceof Scrollable) || ((Scrollable)view).getScrollableTracksViewportWidth())
@@ -167,6 +168,7 @@
       }
     else
       {
+        viewPref.width = viewMinimum.width;
         int overextension = portLowerRight.x - viewPref.width;
         if (overextension > 0)
             portBounds.x -= overextension;
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to