diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatSeparatorUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatSeparatorUI.java index d84d82b8..9529f046 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatSeparatorUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatSeparatorUI.java @@ -28,7 +28,6 @@ import javax.swing.JSeparator; import javax.swing.UIManager; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicSeparatorUI; -import com.formdev.flatlaf.FlatClientProperties; import com.formdev.flatlaf.ui.FlatStyleSupport.Styleable; /** @@ -107,15 +106,8 @@ public class FlatSeparatorUI protected void installListeners( JSeparator s ) { super.installListeners( s ); - propertyChangeListener = e -> { - switch( e.getPropertyName() ) { - case FlatClientProperties.STYLE: - applyStyle( s, this, e.getNewValue() ); - s.revalidate(); - s.repaint(); - break; - } - }; + propertyChangeListener = FlatStyleSupport.createPropertyChangeListener( + s, style -> applyStyle( s, this, style ), null ); s.addPropertyChangeListener( propertyChangeListener ); } diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatSliderUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatSliderUI.java index dbd2d24e..b382e94c 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatSliderUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatSliderUI.java @@ -36,7 +36,6 @@ import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicSliderUI; -import com.formdev.flatlaf.FlatClientProperties; import com.formdev.flatlaf.ui.FlatStyleSupport.Styleable; import com.formdev.flatlaf.util.Graphics2DProxy; import com.formdev.flatlaf.util.HiDPIUtils; @@ -185,18 +184,8 @@ public class FlatSliderUI @Override protected PropertyChangeListener createPropertyChangeListener( JSlider slider ) { - PropertyChangeListener superListener = super.createPropertyChangeListener( slider ); - return e -> { - superListener.propertyChange( e ); - - switch( e.getPropertyName() ) { - case FlatClientProperties.STYLE: - applyStyle( e.getNewValue() ); - slider.revalidate(); - slider.repaint(); - break; - } - }; + return FlatStyleSupport.createPropertyChangeListener( slider, this::applyStyle, + super.createPropertyChangeListener( slider ) ); } /** diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatSplitPaneUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatSplitPaneUI.java index 0b56b0d3..0ef83595 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatSplitPaneUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatSplitPaneUI.java @@ -34,7 +34,6 @@ import javax.swing.UIManager; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicSplitPaneDivider; import javax.swing.plaf.basic.BasicSplitPaneUI; -import com.formdev.flatlaf.FlatClientProperties; import com.formdev.flatlaf.ui.FlatStyleSupport.Styleable; import com.formdev.flatlaf.ui.FlatStyleSupport.UnknownStyleException; import com.formdev.flatlaf.util.UIScale; @@ -117,15 +116,7 @@ public class FlatSplitPaneUI protected void installListeners() { super.installListeners(); - propertyChangeListener = e -> { - switch( e.getPropertyName() ) { - case FlatClientProperties.STYLE: - applyStyle( e.getNewValue() ); - splitPane.revalidate(); - splitPane.repaint(); - break; - } - }; + propertyChangeListener = FlatStyleSupport.createPropertyChangeListener( splitPane, this::applyStyle, null ); splitPane.addPropertyChangeListener( propertyChangeListener ); }