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

FlatMenuUI: remove JMenuBar dependency #794

Closed

Conversation

rogerbj
Copy link

@rogerbj rogerbj commented Jan 13, 2024

A ClassCastException is thrown in FlatMenuUI.java when using a CommandMenuBar.java in JIDE. This occurs since FlatMenuUI assumes there is always a JMenuBar as parent for a JMenuItem. The problem occurs if resizing the width of the window whereas JIDE automatically replaces JMenu's that doesn't fit with a clickable icon. Clicking it shows a popup window with the menus that doesn't fit to display. The owner of the JMenuItem's is then a CommandBarPane instance rather than the original CommandMenuBar. The CCE happens when clicking the icon.

image

This PR generalizes FlatMenuUI to not require a JMenuBar.

With this change it now works fine with JIDE.

@DevCharly
Copy link
Collaborator

Thanks for the PR.

I wonder in which situation the ClassCastException is thrown?

CommandMenuBar extends JMenuBar.
So as long as the JideMenu is a direct child of the CommandMenuBar, it should work fine.

@rogerbj
Copy link
Author

rogerbj commented Jan 17, 2024

@DevCharly I've updated the original PR description with a sample screenshot that uses this PR branch.

DevCharly added a commit that referenced this pull request Jan 23, 2024
@DevCharly
Copy link
Collaborator

Thx. Finally I understand why JideMenu overrides isTopLevelMenu() 😄

Instead of merging this PR, I've cherry picked your commit 4d4b90c.
It is now in FlatLaf/main in commit 0c00117.

This PR contains a lot of "Merge remote-tracking branch 'origin/master'" commits,
which I did not like to add to the history of this repo.

For future PRs, please base them on main branch of this repo.

To update dbvis/FlatLaf repo, it would be better to avoid merging from this repo.
Better fetch commits from this repo to a local FlatLaf repo, do a local fast-forward merge and then push to dbvis/FlatLaf repo.

@DevCharly DevCharly closed this Jan 23, 2024
@DevCharly DevCharly added this to the 3.4 milestone Jan 23, 2024
@rogerbj
Copy link
Author

rogerbj commented Jan 23, 2024

@DevCharly Super! Yeah, sorry the PR did include a lot of commits. Will be more careful in the future.

rogerbj pushed a commit to dbvis/FlatLaf that referenced this pull request Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants