Rectangle (List<? extends RadComponent> selection) { int minRow = Integer.MAX_VALUE; int minCol = Integer.MAX_VALUE; int maxRow = 0; int maxCol = 0; for (RadComponent c : selection) { minRow = Math.min(minRow, c.getConstraints().getRow()); minCol = Math.min(minCol, c.getConstraints().getColumn()); maxRow = Math.max(maxRow, c.getConstraints().getRow() + c.getConstraints().getRowSpan()); maxCol = Math.max(maxCol, c.getConstraints().getColumn() + c.getConstraints().getColSpan()); } return new Rectangle(minCol, minRow, maxCol - minCol, maxRow - minRow); }