I am just getting started with Java2D (more accurately, "restarted" after an 8 year break from Java
) and have hit an interesting behaviour when playing with Java2D. Here is the code in question:
The code above should draw an rectangle when the Render is added to a JFrame, however ends up drawing a square with with the bottom edge misaligned (see attachment).
The issue goes away if I force BasicStroke(1.1f), however feel that this is a bit of a hack.
Why does the miss-alignment happen and what is the "best practise fix" for this?