There is no way to draw two parts of the path with two different line thicknesses in one call to Graphics2D.draw
. You would have to do it in two calls. You might be able to address the connection by setting the cap on the lines differently, like to rounded, for example. If you do this, and the two lines end at the same point, the rounded edge should cover the ends and make it look better. As long as you're not using alpha values to set transparency, this should work great.
g2.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_ROUND);
If you're using transparencies, the above approach would make the join be darker because it's being drawn on twice. In this case, you could try a different approach. Define one shape and use Graphics2D.fill
and set all of the points and arcs manually, making one line slightly thicker. You would absolutely have to have anti-aliasing turned on for it to work, and I'm not sure how it would look.