Closed KlemenDEV closed 3 months ago
For more context, the border here is made using "BorderFactory.createMatteBorder"
This is a Swing repaint bug. See #860 and #582.
It also occurs in MCreator 2024.2 with FlatLaf 3.4.1 and disabled FlatLaf window decorations
(-Dflatlaf.useWindowDecorations=false
) at 175%:
Why do you see it with FlatLaf 3.5, but not with 3.4.1 (with enabled FlatLaf window decorations)? This is because commit https://github.com/JFormDesigner/FlatLaf/commit/72a4c00e72a33aef3b4ea6b8f1986afaa266d2d9#diff-0393d6d30e320a47e5a348543e9382b73ddee2bfa56889beb3c9d4c88a3be8fd moves Java paint area within the win32 window by 1-2 pixels in FlatLaf 3.5.
It's just a coincidence that this is happening with FlatLaf 3.5. Adding some pixels space above the tabs could have same effect with FlatLaf 3.4.1...
Luckily there is a solution in FlatLaf 3.5. See PR #864.
Either use:
tab.setBorder( ... );
HiDPIUtils.repaint( tab );
Or invoke following on application startup:
HiDPIUtils.installHiDPIRepaintManager();
@DevCharly, thank you for the explanation. Will test asap
There is a bug in FlatLaf when using HiDPIUtils.installHiDPIRepaintManager()
:
Working on a fix...
bug in HiDPIUtils.installHiDPIRepaintManager()
is fixed in latest 3.5.1-SNAPSHOT
:
https://github.com/JFormDesigner/FlatLaf#snapshots
I have done more testing on 3.5.1-SNAPSHOT and it seems both border rendering (tested on a 175% scale) and tags work fine.
Thank you for your tests and a very quick fix! :)
On 125% or 175% scales on Windows, the border is not fully updated in some cases when calling "setBorder", where chunks of the border do not update. Calling a repaint of revalidate does not help. Those artifacts are cleared on window resize. Does not happen on 3.4.1.
See example - green line the remains below WORKSPACE "tab" - this tab is a custom component where the line below is standard line border set with "setBorder" depending if the tab is active or not. This thin line is not present on 3.4.1 and not set by our code. It also goes away if the window is resized as also seen on the gif below.