JFormDesigner / FlatLaf

FlatLaf - Swing Look and Feel (with Darcula/IntelliJ themes support)
https://www.formdev.com/flatlaf/
Apache License 2.0
3.34k stars 266 forks source link

Improve the window buttons hover rectangle at scales > 100% #431

Closed ebourg closed 2 years ago

ebourg commented 2 years ago

With a 200% scaling, the rectangle painted when the window buttons are hovered stops 1 pixel before the top border:

image

And at intermediate scales the top, left and bottom borders of the rectangle are blurry.

Example at 150%: image

Example at 125%: image

DevCharly commented 2 years ago

Thanks for reporting.

Fixed the blurry rectangles at intermediate scales.

The 1px space between top border and button hover rectangle at 200% is not fixed. This is difficult and IMHO not worth the effort (see below). It is only a issue on Windows 10 and only if mouse is over a iconify/maximize/close button. Windows 11 paints all 4 border sides and there is no gap.

On Windows 10, the top border is painted by FlatLaf and the other 3 borders by Windows 10. So there is a Swing border with insets (1,0,0,0). At 200%, the Swing layout reserves 2px for the top border, but FlatLaf paints only a 1px line to be consistent with the other 3 sides.

To fix the gap it would be necessary to layout the buttons to y = 0.5, which is not possible. Or to paint the button background outside of its bounds, which did not work, probably because of some clipping. Even changing/removing clipping of/from button painting graphics context does not paint outside of button bounds.

ebourg commented 2 years ago

Thank you for investigating this issue.