Commit 3556836f by Roman Kennke Committed by Michael Koch

2005-04-18 Roman Kennke <roman@kennke.org>

	* java/awt/BorderLayout.java
	(calcSize): Check for overflow when component sizes are added.

From-SVN: r98347
parent f5373caf
2005-04-18 Roman Kennke <roman@kennke.org>
* java/awt/BorderLayout.java
(calcSize): Check for overflow when component sizes are added.
2005-04-18 Robert Schuster <thebohemian@gmx.net> 2005-04-18 Robert Schuster <thebohemian@gmx.net>
* java/awt/AWTEvent.java (toString): Added case * java/awt/AWTEvent.java (toString): Added case
......
...@@ -700,6 +700,10 @@ calcSize(Container target, int what) ...@@ -700,6 +700,10 @@ calcSize(Container target, int what)
Dimension cdim = calcCompSize(center, what); Dimension cdim = calcCompSize(center, what);
int width = edim.width + cdim.width + wdim.width + (hgap * 2); 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) if (ndim.width > width)
width = ndim.width; width = ndim.width;
if (sdim.width > width) if (sdim.width > width)
...@@ -713,7 +717,13 @@ calcSize(Container target, int what) ...@@ -713,7 +717,13 @@ calcSize(Container target, int what)
if (wdim.height > height) if (wdim.height > height)
height = wdim.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)); return(new Dimension(width, height));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment