stroke = new BasicStroke(
               0.2f*ds,//width
               BasicStroke.CAP_SQUARE,
               BasicStroke.JOIN_BEVEL);
     g2.setStroke(stroke);

Figure 8