#20771 closed defect (fixed)
[Patch] MainFrame created before setting look and feel and not updated
| Reported by: | DevCharly | Owned by: | simon04 |
|---|---|---|---|
| Priority: | normal | Milestone: | 21.04 |
| Component: | Core | Version: | |
| Keywords: | Cc: |
Description
In class MainApplication, the main frame is created before the look and feel is set.
And it is not updated after the look and feel have set.
This usually has no visual impact because the only component created before the L&F was set, is the JRootPane of the JFrame.
So the UI delegate of the JRootPane remains MetalRootPaneUI.
But FlatLaf 1.1 supports native window decorations (on Windows 10) and needs FlatRootPaneUI to initialize it.
https://github.com/JFormDesigner/FlatLaf/releases/tag/1.1
To fix this I'd like to suggest to update the mainFrame with following code after setting the L&F:
SwingUtilities.updateComponentTreeUI(mainFrame);
Attachments (5)
Change History (14)
by , 5 years ago
| Attachment: | JOSM-mainFrame-updateUI.diff added |
|---|
by , 5 years ago
| Attachment: | JOSM-mainFrame-updateUI-off.png added |
|---|
by , 5 years ago
| Attachment: | JOSM-mainFrame-updateUI-on.png added |
|---|
comment:2 by , 5 years ago
| Summary: | MainFrame created before setting look and feel and not updated → [Patch] MainFrame created before setting look and feel and not updated |
|---|
comment:3 by , 5 years ago
How does the title bar look when the user name is displayed with preference draw.show-user set to true?
comment:4 by , 5 years ago
The window title (incl. user name) is shown in the area between the "Help" menu and the minimize button.
If the title is longer, then it is cut-off with "...".
If the window is wider than in the above screenshot, then there is more space for the title.
BTW the screenshots are so large because they were made on a 150% scaled screen.
comment:5 by , 5 years ago
| Milestone: | → 21.04 |
|---|---|
| Owner: | changed from to |
| Status: | new → assigned |
comment:7 by , 5 years ago
Not sure if this ticket or #20706 caused this, but I see changes on Windows without FlatLaf, too.
by , 5 years ago
| Attachment: | r17702.PNG added |
|---|
by , 5 years ago
| Attachment: | r18004.PNG added |
|---|



The patch (and latest flatlaf plugin from today) changes this (on Windows 10):
into this
Window title bar of main frame is dark and menubar is embedded into window title bar.