diff options
Diffstat (limited to 'libjava/classpath/javax/swing/ViewportLayout.java')
-rw-r--r-- | libjava/classpath/javax/swing/ViewportLayout.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/libjava/classpath/javax/swing/ViewportLayout.java b/libjava/classpath/javax/swing/ViewportLayout.java index 18b49125743..19735839387 100644 --- a/libjava/classpath/javax/swing/ViewportLayout.java +++ b/libjava/classpath/javax/swing/ViewportLayout.java @@ -69,7 +69,11 @@ public class ViewportLayout implements LayoutManager, Serializable JViewport vp = (JViewport)parent; Component view = vp.getView(); if (view != null) - return view.getPreferredSize(); + { + if (view instanceof Scrollable) + return ((Scrollable)view).getPreferredScrollableViewportSize(); + return view.getPreferredSize(); + } else return new Dimension(); } @@ -120,7 +124,7 @@ public class ViewportLayout implements LayoutManager, Serializable JViewport port = (JViewport) parent; Component view = port.getView(); - + if (view == null) return; @@ -139,7 +143,8 @@ public class ViewportLayout implements LayoutManager, Serializable if (portBounds.height >= viewMinimum.height) { portBounds.y = 0; - viewPref.height = portBounds.height; + if ( !(view instanceof Scrollable) || ((Scrollable)view).getScrollableTracksViewportHeight()) + viewPref.height = portBounds.height; } else { @@ -153,7 +158,8 @@ public class ViewportLayout implements LayoutManager, Serializable if (portBounds.width >= viewMinimum.width) { portBounds.x = 0; - viewPref.width = portBounds.width; + if ( !(view instanceof Scrollable) || ((Scrollable)view).getScrollableTracksViewportWidth()) + viewPref.width = portBounds.width; } else { |