In my paintComponent, I have drawRect, which draws a single rectangle. However, I want to make the outline of the rectangle thicker but I don’t know how. So I thought of making another rectangle inside the existing one. I tried putting another drawRect but the rectangle isn’t in the center.
Thanks for those who’ll help!
The argument passed to the
paintComponent(Graphics)method of a Swing component should actually be aGraphics2Dinstance. It can be cast to one.See this example in which 3 strokes are layered.