Rectangle (final String quadrant, final Dimension initialSize) { Dimension size = myContainer.getDelegee().getSize(); int initialWidth = (initialSize.width > 0 && initialSize.width < size.width) ? initialSize.width : size.width/3; int initialHeight = (initialSize.height > 0 && initialSize.height < size.height) ? initialSize.height: size.height/3; if (quadrant.equals(BorderLayout.WEST)) { int deltaN = getHeightAtConstraint(BorderLayout.NORTH); int deltaS = getHeightAtConstraint(BorderLayout.SOUTH); return new Rectangle(0, deltaN, initialWidth, size.height - deltaN - deltaS); } if (quadrant.equals(BorderLayout.NORTH)) { return new Rectangle(0, 0, size.width, initialHeight); } if (quadrant.equals(BorderLayout.EAST)) { int deltaN = getHeightAtConstraint(BorderLayout.NORTH); int deltaS = getHeightAtConstraint(BorderLayout.SOUTH); return new Rectangle(size.width - initialWidth, deltaN, initialWidth, size.height - deltaN - deltaS); } if (quadrant.equals(BorderLayout.SOUTH)) { return new Rectangle(0, size.height - initialHeight, size.width, initialHeight); } return new Rectangle(size.width/3, size.height/3, size.width/3, size.height/3); }