You need to make the correct calculation to build a Bezier curve. The curve should not fall on the components, but should bend around them. In the screenshot - as needed. Well, plus the algorithm that is being built.
Path2D.Float path = new Path2D.Float(); List<Point2D.Float> points = заполняю лист точками; for (int i = 3; i < points.size(); i += 3) { path.curveTo(points.get(i - 2).x, points.get(i - 2).y, points.get(i - 1).x, points.get(i - 1).y, points.get(i).x, points.get(i).y); } 