From babb9a153985eedd85f0be9bd5c1be4110418307 Mon Sep 17 00:00:00 2001 From: Jannis Weis <31143295+weisJ@users.noreply.github.com> Date: Thu, 5 Jan 2023 17:57:09 +0100 Subject: [PATCH] Menu: Allow specifying non rounded corners on menubars --- .../java/com/github/weisj/darklaf/ui/menu/DarkMenuUI.java | 5 +++++ .../com/github/weisj/darklaf/nativelaf/windows11.properties | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/menu/DarkMenuUI.java b/core/src/main/java/com/github/weisj/darklaf/ui/menu/DarkMenuUI.java index c32eeb4e..b9982484 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/menu/DarkMenuUI.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/menu/DarkMenuUI.java @@ -40,6 +40,7 @@ public class DarkMenuUI extends BasicMenuUI implements MenuItemUI { protected Icon arrowIconDisabled; protected JMenu menu; private int arc; + private int topLevelArc; public static ComponentUI createUI(final JComponent x) { return new DarkMenuUI(); @@ -121,6 +122,7 @@ public class DarkMenuUI extends BasicMenuUI implements MenuItemUI { PropertyUtil.parseBooleanProperty(UIManager.get(getPropertyPrefix() + ".evenHeight"), true); acceleratorTextOffset = UIManager.getInt(getPropertyPrefix() + ".acceleratorTextOffset"); arc = UIManager.getInt("MenuItem.arc"); + topLevelArc = UIManager.getInt("MenuBar.arc"); } @Override @@ -191,6 +193,9 @@ public class DarkMenuUI extends BasicMenuUI implements MenuItemUI { @Override public int getArc() { + if (menu.isTopLevelMenu()) { + return topLevelArc; + } return arc; } diff --git a/core/src/main/resources/com/github/weisj/darklaf/nativelaf/windows11.properties b/core/src/main/resources/com/github/weisj/darklaf/nativelaf/windows11.properties index 22210d5f..df26d0ed 100644 --- a/core/src/main/resources/com/github/weisj/darklaf/nativelaf/windows11.properties +++ b/core/src/main/resources/com/github/weisj/darklaf/nativelaf/windows11.properties @@ -40,9 +40,11 @@ PopupMenuDivider.size = 9,9 MenuItem.insets = 1,7,1,7 MenuItem.arc = %arc -MenuBar.border.margins = 5,0,5,0 Menu.rollOverEnabled = true +MenuBar.arc = %arc +MenuBar.border.margins = 5,0,5,0 + MenuItem.margin = 1,9,1,9 CheckBoxMenuItem.margin = 1,9,1,9 RadioButtonMenuItem.margin = 1,9,1,9