summaryrefslogtreecommitdiff
path: root/javax/swing/ViewportLayout.java
diff options
context:
space:
mode:
authorAnthony Balkissoon <abalkiss@redhat.com>2005-09-01 17:31:53 +0000
committerAnthony Balkissoon <abalkiss@redhat.com>2005-09-01 17:31:53 +0000
commit912e4bf4f4b6dd6efb32ff3bcea4c084be76fa01 (patch)
tree5a553d693fbc1d1e06ceec2ec1b761fac0c58a20 /javax/swing/ViewportLayout.java
parent100c61552a5b210cba1a3a3a14954af8c5de6ed8 (diff)
downloadclasspath-912e4bf4f4b6dd6efb32ff3bcea4c084be76fa01.tar.gz
2005-09-01 Anthony Balkissoon <abalkiss@redhat.com>
Fixes bug #23204 * javax/swing/ViewportLayout.java: (preferredLayoutSize): If the view is scrollable, call its getPreferredScrollableViewportSize method. (layoutContainer): If the view is scrollable, check its getScrollableTracksViewportWidth and getScrollableTracksViewportHeight methods before resizing the view to match the viewport.
Diffstat (limited to 'javax/swing/ViewportLayout.java')
-rw-r--r--javax/swing/ViewportLayout.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/javax/swing/ViewportLayout.java b/javax/swing/ViewportLayout.java
index 18b491257..197358393 100644
--- a/javax/swing/ViewportLayout.java
+++ b/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
{