The BasicStroke class defines a basic set of rendering attributes for
the outlines of graphics primitives, which are rendered with a
Graphics2D object that has its Stroke attribute set to this
BasicStroke.
is setting the line width,since BasicStroke(float width):
Constructs a solid BasicStroke with the specified line width and with default values for the cap and join styles.
And, it also effects other methods like Graphics2D.drawLine(int x1, int y1, int x2, int y2) and Graphics2D.drawRect(int x, int y, int width, int height):
The methods of the Graphics2D interface that use the outline Shape
returned by a Stroke object include draw and any other methods that
are implemented in terms of that method, such as drawLine, drawRect,
drawRoundRect, drawOval, drawArc, drawPolyline, and drawPolygon.