FlatLaf icon indicating copy to clipboard operation
FlatLaf copied to clipboard

Window paint incomplete

Open medmedin2014 opened this issue 2 years ago • 9 comments

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

medmedin2014 avatar Jan 24 '22 22:01 medmedin2014

Does it work without FlatAnimatedLafChange ? What is disabledLayer?

DevCharly avatar Jan 24 '22 22:01 DevCharly

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.

medmedin2014 avatar Jan 24 '22 23:01 medmedin2014

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

DevCharly avatar Jan 24 '22 23:01 DevCharly

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.

medmedin2014 avatar Jan 24 '22 23:01 medmedin2014

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.

DevCharly avatar Jan 24 '22 23:01 DevCharly

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

text4189-2

medmedin2014 avatar Jan 24 '22 23:01 medmedin2014

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?

DevCharly avatar Jan 25 '22 00:01 DevCharly

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 avatar Jan 25 '22 00:01 medmedin2014

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.

medmedin2014 avatar Jan 25 '22 16:01 medmedin2014