JFormDesigner / FlatLaf

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

Window paint incomplete #472

Closed medmedin2014 closed 5 months ago

medmedin2014 commented 2 years ago

When I set a new L&F at runtime, some windows paint is incomplete and needs to be opened and closed two times to be fully painted with the new theme.

Screenshot_20220124_231934

DevCharly commented 2 years ago

Does it work without FlatAnimatedLafChange ? What is disabledLayer?

medmedin2014 commented 2 years ago

With FlatAnimatedLafChange and disabledLayer lines removed it still doesn't work. disabledLayer is a simple JComponent that will be set as GlassPane on top of the frame to block all mouse and keyboard events until all UI elements are updated with new theme.

DevCharly commented 2 years ago

The "JSignPdf" window looks OK on your screenshot. It the problem only in the "TSA ..." dialog?

medmedin2014 commented 2 years ago

Yes, the problem appears on frames and dialogs that were already created and not visible, but if I open and close each of them two or three times then they get fixed and show correct theme.

DevCharly commented 2 years ago

You should know that only those components are updated that are in windows. See for(Window w : Window.getWindows()).

Components that are created, but not added to a window, are not updated. If you later show such components, the have the wrong look.

medmedin2014 commented 2 years ago

It's an instance of JDialog and is member of a class of type JFrame.

text4189-2

DevCharly commented 2 years ago

Very strange... 😕

When the TSA dialog is shown wrong, does it always look like in the first screenshot? Or random?

Is the TSA dialog repainted correctly if you resize the dialog?

medmedin2014 commented 2 years ago

It's random, and if I resize the window just a little then the theme is applied instantly to it. I tested it on OpenJDK 8, 11 and 17 and got same result.

medmedin2014 commented 2 years ago

It seems to occur only on Linux, in my case Manjaro KDE, but on Windows 10 with both OpenJDK 15 and 17 the problem doesn't exist.