Browse Source

Menu: Allow specifying non rounded corners on menubars

pull/336/head
Jannis Weis 2 years ago
parent
commit
babb9a1539
No known key found for this signature in database
GPG Key ID: 7C9D8D4B558049AB
  1. 5
      core/src/main/java/com/github/weisj/darklaf/ui/menu/DarkMenuUI.java
  2. 4
      core/src/main/resources/com/github/weisj/darklaf/nativelaf/windows11.properties

5
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 Icon arrowIconDisabled;
protected JMenu menu; protected JMenu menu;
private int arc; private int arc;
private int topLevelArc;
public static ComponentUI createUI(final JComponent x) { public static ComponentUI createUI(final JComponent x) {
return new DarkMenuUI(); return new DarkMenuUI();
@ -121,6 +122,7 @@ public class DarkMenuUI extends BasicMenuUI implements MenuItemUI {
PropertyUtil.parseBooleanProperty(UIManager.get(getPropertyPrefix() + ".evenHeight"), true); PropertyUtil.parseBooleanProperty(UIManager.get(getPropertyPrefix() + ".evenHeight"), true);
acceleratorTextOffset = UIManager.getInt(getPropertyPrefix() + ".acceleratorTextOffset"); acceleratorTextOffset = UIManager.getInt(getPropertyPrefix() + ".acceleratorTextOffset");
arc = UIManager.getInt("MenuItem.arc"); arc = UIManager.getInt("MenuItem.arc");
topLevelArc = UIManager.getInt("MenuBar.arc");
} }
@Override @Override
@ -191,6 +193,9 @@ public class DarkMenuUI extends BasicMenuUI implements MenuItemUI {
@Override @Override
public int getArc() { public int getArc() {
if (menu.isTopLevelMenu()) {
return topLevelArc;
}
return arc; return arc;
} }

4
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.insets = 1,7,1,7
MenuItem.arc = %arc MenuItem.arc = %arc
MenuBar.border.margins = 5,0,5,0
Menu.rollOverEnabled = true Menu.rollOverEnabled = true
MenuBar.arc = %arc
MenuBar.border.margins = 5,0,5,0
MenuItem.margin = 1,9,1,9 MenuItem.margin = 1,9,1,9
CheckBoxMenuItem.margin = 1,9,1,9 CheckBoxMenuItem.margin = 1,9,1,9
RadioButtonMenuItem.margin = 1,9,1,9 RadioButtonMenuItem.margin = 1,9,1,9

Loading…
Cancel
Save