Re: Lineweight dependent on drawing scale - how to keep line weight at 1



PaulSchrum wrote:
I am drawing Line2D and Quad2D elements on a JFrame using Graphics2D.

When I increase the scale of the Graphics2D transform, the line weight
increases, and I would rather this not happen. Is there a way I can
suppress this?

While I am on the subject, is there a way to manage lineweights in
Graphics2D at all or independently of scale?

Thanks.

- Paul Schrum

If you set the stroke to have 0 width, it will draw the smallest
possible line on the output device. That may not be what you want,
however.

The alternative is to adjust the width of the stroke based on the scale
factor, but that doesn't work well if you have vastly different scales
for x and y.

look up Graphics2D.setStroke()

.