aboutsummaryrefslogtreecommitdiff
path: root/libjava/javax/swing/ViewportLayout.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/javax/swing/ViewportLayout.java')
-rw-r--r--libjava/javax/swing/ViewportLayout.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/libjava/javax/swing/ViewportLayout.java b/libjava/javax/swing/ViewportLayout.java
index 4738baccd1a..3abf31da385 100644
--- a/libjava/javax/swing/ViewportLayout.java
+++ b/libjava/javax/swing/ViewportLayout.java
@@ -52,7 +52,7 @@ import java.io.Serializable;
*/
public class ViewportLayout implements LayoutManager, Serializable
{
- static final long serialVersionUID = -788225906076097229L;
+ private static final long serialVersionUID = -788225906076097229L;
public ViewportLayout()
{
@@ -63,17 +63,25 @@ public class ViewportLayout implements LayoutManager, Serializable
public void removeLayoutComponent(Component c)
{
}
+
public Dimension preferredLayoutSize(Container parent)
{
JViewport vp = (JViewport)parent;
Component view = vp.getView();
+ if (view != null)
return view.getPreferredSize();
+ else
+ return new Dimension();
}
+
public Dimension minimumLayoutSize(Container parent)
{
JViewport vp = (JViewport)parent;
Component view = vp.getView();
- return view.getMinimumSize();
+ if (view != null)
+ return view.getMinimumSize();
+ else
+ return new Dimension();
}
/**
@@ -113,6 +121,9 @@ public class ViewportLayout implements LayoutManager, Serializable
JViewport port = (JViewport) parent;
Component view = port.getView();
+ if (view == null)
+ return;
+
// These dimensions and positions are in *view space*. Do not mix
// variables in here from port space (eg. parent.getBounds()). This
// function should be entirely in view space, because the methods on