How do I define stroke when drawing a shape in Java 2D?

This code snippet produce the following output:

Draw Stroke Demo