I have some shapes created by class Rectangle and I want to surround them with a thick border. However the methods drawRect and drawOval form Graphics class create a thin line as the border of the shape. How can I adjust them so as me to able to manipulate the thickness of the border line? If this is not possible or quite effective, what is another way to assign an adjustable border on the shapes? May I need Rectangle2D or Graphics2D?
After that, do you know how I can “round” the angles of the border of a square so as not to be sharp?
To make the border thicker, use
Graphics2D.setStroke(...). And to draw “rounded” rectangles, useGraphics.drawRoundRect(...).