Index: java/awt/BorderLayout.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/awt/BorderLayout.java,v retrieving revision 1.13 diff -u -r1.13 BorderLayout.java --- java/awt/BorderLayout.java 16 Feb 2005 10:39:25 -0000 1.13 +++ java/awt/BorderLayout.java 16 Apr 2005 23:35:52 -0000 @@ -700,6 +700,10 @@ Dimension cdim = calcCompSize(center, what); int width = edim.width + cdim.width + wdim.width + (hgap * 2); + // check for overflow + if (width < edim.width || width < cdim.width || width < cdim.width) + width = Integer.MAX_VALUE; + if (ndim.width > width) width = ndim.width; if (sdim.width > width) @@ -713,7 +717,13 @@ if (wdim.height > height) height = wdim.height; - height += (ndim.height + sdim.height + (vgap * 2) + ins.top + ins.bottom); + int addedHeight = height + (ndim.height + sdim.height + (vgap * 2) + + ins.top + ins.bottom); + // check for overflow + if (addedHeight < height) + height = Integer.MAX_VALUE; + else + height = addedHeight; return(new Dimension(width, height)); }