Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some or all JMenuBar menus might be hidden #545

Closed
mgarin opened this issue Sep 24, 2019 · 2 comments
Closed

Some or all JMenuBar menus might be hidden #545

mgarin opened this issue Sep 24, 2019 · 2 comments

Comments

@mgarin
Copy link
Owner

mgarin commented Sep 24, 2019

When JMenuBar is set as JRootPane menu bar under JDK 9+ it calls updateUI () on the JMenuBar and with WebLaF it causes corrupted menu bar layout. This leads to multiple possible visual issues depending on when JMenuBar was set as JRootPane menu bar.

There is no good workaround for this, so I will simply make layout preserve it's constraints properly whenever UI is replaced. That will also require some enhancements for the WebLaF layouts.

@mgarin mgarin added this to the v1.2.11 milestone Sep 24, 2019
@mgarin mgarin self-assigned this Sep 24, 2019
mgarin added a commit that referenced this issue Sep 25, 2019
- InsetsUIResource.java - Better `Insets` extension that is `UIResource` and can be cloned and merged
- ComponentStyle.java, ComponentStyleConverter.java - Replaced `Insets` with `InsetsUIResource`
- ComponentStyle.java, AbstractLayoutManager.java - Added workaround for layout constraints preservation

Layout [ #545 ]
- AbstractLayoutManager.java - Added API for migrating layout settings upon their replacement through styling system
- AbstractLineLayout.java - Added migration capabilities

MenuBar [ #545 ]
- WMenuBarUI.java, - New optimized basic UI implementation
- MenuBarLayout.java, StyleManager.java - Added `UIResource` implementation and XStream aliases
- WebMenuBarUI.java - Removed layout definition, it will now be provided in style
- menubar.xml - Added layout definition instead of one in `WebMenuBarUI`
- menubar.xml - Added padding to make popup menu of first element fit into root pane bounds to use lightweight popup

PopupMenu
- popupmenu.xml - Slightly reduced shadow to have lesser overlap with functional elements and fit into root pane bounds in more cases

StatusBar
- StatusBarLayout.java, StyleManager.java - Added `UIResource` implementation and XStream aliases
- WebStatusBar.java - Removed layout definition, it will now be provided in style
- statusbar.xml - Added layout definition instead of one in `WebStatusBar`

ToolBar
- ToolbarLayout.java, StyleManager.java - Added `UIResource` implementation and XStream aliases
- WebToolBarUI.java - Removed layout definition, it will now be provided in style
- toolbar.xml - Added layout definition instead of one in `WebToolBarUI`
- WebToolBar.java - Overridden missing basic `JToolBar` method for adding a sized separator

TabbedPane
- TabArea.java, TabContainer.java - Changed initial layout to `null` to allow it's provision through style

Accordion
- AccordionPane.java - Changed initial layout to `null` to allow it's provision through style

Link [ #547 ]
- WebLink.java - Fixed translation of `LinkAction` text if it is a language key

Label
- WebLabelUI.java - Added missing generics

InterfaceInspector
- InterfaceInspector.java - Added `VisibilityBehavior` to correctly hide inspected element when inspector is hidden
- InterfaceInspector.java - Now requests focus for the tree when inspector tool have picked inspected target
- InterfaceTree.java - Added `VisibilityBehavior` to disable all behaviors while tree is not visible
- InterfaceTreeNode.java - Moved windows listener here from `InterfaceTreeDataProvider`
- InterfaceTreeNodeComparator.java - Separated from `InterfaceTreeDataProvider`

Utilities
- TreeUtils.java - Tree state restore performance optimization
- VisibilityBehavior.java - Updated API to provide tracked `Component` of generic type
- VisibilityBehavior.java - Overridable methods are not abstract anymore so there is no need to override both if not necessary

DemoApplication
- AbstractTitledPreview.java - Simplified layout and component order
- AbstractPreviewExample.java - Removed property listener usage that doesn't work correctly
- ExamplesTreeNode.java - Refactored to avoid `null` parameters being passed
- InspectorFrame.java - Removed now unnecessary deselection of inspected element
- ResourceLocation.java - Removed unnecessary `Serializable` marker
- demo-language.xml - Added missing popover basic example title
@mgarin
Copy link
Owner Author

mgarin commented Sep 25, 2019

This should be fixed now for JDK 9+.
I've also replaced BasicMenuBarUI with a custom implementation to ensure that only custom WebLaF layout is used by default and that it correctly inherits constraints even when Swing calls for UI update.

@mgarin
Copy link
Owner Author

mgarin commented May 22, 2020

An important note - in case DefaultMenuLayout is used it will still be replaced with L&F layout because it is a UIResource. This may look like a bug, but it's not, simply don't use any UIResource settings outside of ComponentUI implementations. In that particular case - simple BoxLayout should be used instead to avoid any issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant