summaryrefslogtreecommitdiff
path: root/libjava/classpath/javax/swing/ScrollPaneLayout.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/classpath/javax/swing/ScrollPaneLayout.java')
-rw-r--r--libjava/classpath/javax/swing/ScrollPaneLayout.java26
1 files changed, 13 insertions, 13 deletions
diff --git a/libjava/classpath/javax/swing/ScrollPaneLayout.java b/libjava/classpath/javax/swing/ScrollPaneLayout.java
index edf1f1f4292..b00b5c4e7ae 100644
--- a/libjava/classpath/javax/swing/ScrollPaneLayout.java
+++ b/libjava/classpath/javax/swing/ScrollPaneLayout.java
@@ -285,20 +285,20 @@ public class ScrollPaneLayout
// 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);
}
/**