diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/splitpane/DarkSplitPaneUI.java b/core/src/main/java/com/github/weisj/darklaf/ui/splitpane/DarkSplitPaneUI.java index be7428db..a21d6992 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/splitpane/DarkSplitPaneUI.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/splitpane/DarkSplitPaneUI.java @@ -49,7 +49,7 @@ public class DarkSplitPaneUI extends BasicSplitPaneUI implements PropertyChangeL public static ComponentUI createUI(final JComponent c) { - return new DarkSplitPaneUI(Style.DEFAULT); + return new DarkSplitPaneUI(Style.get(UIManager.getString("SplitPane.defaultDividerStyle"))); } @Override @@ -88,7 +88,7 @@ public class DarkSplitPaneUI extends BasicSplitPaneUI implements PropertyChangeL @Override public BasicSplitPaneDivider createDefaultDivider() { - if (style == Style.DEFAULT) { + if (style == Style.GRIP) { return new DarkSplitPaneDivider(this); } else { return new ThinDivider(this); @@ -102,7 +102,7 @@ public class DarkSplitPaneUI extends BasicSplitPaneUI implements PropertyChangeL @Override public void layoutContainer(final Container parent) { super.layoutContainer(parent); - if (style != Style.DEFAULT) { + if (style != Style.GRIP) { Rectangle bounds = getDivider().getBounds(); if (getOrientation() == JSplitPane.HORIZONTAL_SPLIT) { bounds.x -= DIVIDER_DRAG_OFFSET; @@ -128,10 +128,10 @@ public class DarkSplitPaneUI extends BasicSplitPaneUI implements PropertyChangeL } else if (Style.LINE.name.equals(val)) { style = Style.LINE; } else { - style = Style.DEFAULT; + style = Style.GRIP; } if (oldStyle != style) { - if (style == Style.DEFAULT || oldStyle == Style.DEFAULT) { + if (style == Style.GRIP || oldStyle == Style.GRIP) { splitPane.setUI(new DarkSplitPaneUI(style)); } else { splitPane.doLayout(); @@ -147,7 +147,7 @@ public class DarkSplitPaneUI extends BasicSplitPaneUI implements PropertyChangeL } private enum Style { - DEFAULT("default"), + GRIP("grip"), LINE("line"), INVISIBLE("invisible"); @@ -157,6 +157,14 @@ public class DarkSplitPaneUI extends BasicSplitPaneUI implements PropertyChangeL Style(final String name) { this.name = name; } + + static Style get(final String style) { + try { + return valueOf(style); + } catch (IllegalArgumentException e) { + return GRIP; + } + } } private final class ThinDivider extends BasicSplitPaneDivider { diff --git a/core/src/main/resources/com/github/weisj/darklaf/properties/ui/splitPane.properties b/core/src/main/resources/com/github/weisj/darklaf/properties/ui/splitPane.properties index 084c042f..f6bbda7a 100644 --- a/core/src/main/resources/com/github/weisj/darklaf/properties/ui/splitPane.properties +++ b/core/src/main/resources/com/github/weisj/darklaf/properties/ui/splitPane.properties @@ -29,6 +29,7 @@ SplitPane.highlight = %backgroundContainer SplitPane.dividerLineColor = %borderSecondary SplitPane.dividerFocusColor = null SplitPane.centerOneTouchButtons = true +SplitPane.defaultDividerStyle = grip #Icons SplitPane.horizontalGlue.icon = navigation/horizontalGlue.svg[themed](4,13) diff --git a/core/src/test/java/ui/splitPane/SplitPaneDemo.java b/core/src/test/java/ui/splitPane/SplitPaneDemo.java index 53b7e759..bb7f2d14 100644 --- a/core/src/test/java/ui/splitPane/SplitPaneDemo.java +++ b/core/src/test/java/ui/splitPane/SplitPaneDemo.java @@ -76,10 +76,10 @@ public final class SplitPaneDemo implements ComponentDemo { }}, "sgx"); controlPanel.add(new JLabel("JSplitPane.style:", JLabel.RIGHT)); controlPanel.add(new JComboBox() {{ - addItem("default"); + addItem("grip"); addItem("line"); addItem("invisible"); - setSelectedItem("default"); + setSelectedItem(UIManager.get("SplitPane.defaultDividerStyle")); addItemListener(e -> splitPane.putClientProperty("JSplitPane.style", e.getItem())); }}, "sgx"); return panel;