Skip to content

Commit

Permalink
MenuBar: fixed NPE in FlatMenuItemRenderer.getTopLevelFont() if men…
Browse files Browse the repository at this point in the history
…u item does not have a parent (issue #600; regression since implementing #589 in FlatLaf 2.5; commit f6c5db0)
  • Loading branch information
DevCharly committed Oct 17, 2022
1 parent 6c502ad commit bc7c68e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -12,6 +12,9 @@ FlatLaf Change Log

- ComboBox and Spinner: Fixed missing arrow buttons if preferred height is zero.
Minimum width of arrow buttons is 3/4 of default width.
- MenuBar: Fixed NPE in `FlatMenuItemRenderer.getTopLevelFont()` if menu item
does not have a parent. (issue #600; regression since implementing #589 in
FlatLaf 2.5)
- TabbedPane: Switch and close tabs on left mouse click only. (PR #595)
- ScrollBar: Show "pressed" feedback on track/thumb only for left mouse button.
If absolute positioning is enabled (the default), then also for middle mouse
Expand Down
Expand Up @@ -500,7 +500,11 @@ protected boolean isUnderlineSelection() {

private Font getTopLevelFont() {
Font font = menuItem.getFont();
return (font != menuFont) ? font : menuItem.getParent().getFont();
// menu item parent may be null if JMenu.isTopLevelMenu() is overridden
// and does not check parent (e.g. com.jidesoft.swing.JideMenu.isTopLevelMenu())
return (font != menuFont || menuItem.getParent() == null)
? font
: menuItem.getParent().getFont();
}

private Icon getIconForPainting() {
Expand Down

0 comments on commit bc7c68e

Please sign in to comment.