@Override
		public Rectangle getMyPlacement(Dimension toBePlaced, Rectangle context, Rectangle outer) {

			Rectangle bestRectangle = null;
			int bestArea = Integer.MAX_VALUE;

			Rectangle rectangle;
			Rectangle intersection;
			int area;

			int top = getLesserLocation(context.y, context.height, toBePlaced.height);
			int bottom = getGreaterLocation(context.y, context.height, toBePlaced.height);
			int left = getLesserLocation(context.x, context.width, toBePlaced.width);
			int right = getGreaterLocation(context.x, context.width, toBePlaced.width);

			int topShifted = getLesserBoundedLocation(top, outer.y);
			int bottomShifted =
				getGreaterBoundedLocation(bottom, toBePlaced.height, outer.y, outer.height);
			int leftShifted = getLesserBoundedLocation(left, outer.x);
			int rightShifted =
				getGreaterBoundedLocation(right, toBePlaced.width, outer.x, outer.width);

			if (bottomShifted < topShifted || rightShifted < leftShifted) {
				return null; // no solution fits within outer bounds
			}

			// Bottom Right
			rectangle = new Rectangle(new Point(rightShifted, bottomShifted), toBePlaced);
			intersection = rectangle.intersection(context);
			area = intersection.width * intersection.height;
			if (area < bestArea) {
				bestArea = area;
				bestRectangle = rectangle;
			}

			// Bottom Left
			rectangle = new Rectangle(new Point(leftShifted, bottomShifted), toBePlaced);
			intersection = rectangle.intersection(context);
			area = intersection.width * intersection.height;
			if (area < bestArea) {
				bestArea = area;
				bestRectangle = rectangle;
			}

			// Top Right
			rectangle = new Rectangle(new Point(rightShifted, topShifted), toBePlaced);
			intersection = rectangle.intersection(context);
			area = intersection.width * intersection.height;
			if (area < bestArea) {
				bestArea = area;
				bestRectangle = rectangle;
			}

			// Top Left
			rectangle = new Rectangle(new Point(leftShifted, topShifted), toBePlaced);
			intersection = rectangle.intersection(context);
			area = intersection.width * intersection.height;
			if (area < bestArea) {
				bestArea = area;
				bestRectangle = rectangle;
			}

			return bestRectangle;
		}
Placer picks corner with toBePlaced as the least overlap with innerBounds. In the case of a
tie, the tie-breaker is first in this order: Bottom Right, Bottom Left, Top Right, Top  Left.
Ghidra/Framework/Docking/src/main/java/docking/widgets/shapes/PopupWindowPlacer.java