mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-13 07:17:13 -06:00
Styling: use FlatStyleSupport.createPropertyChangeListener() where possible/useful
This commit is contained in:
@@ -28,7 +28,6 @@ import javax.swing.JSeparator;
|
|||||||
import javax.swing.UIManager;
|
import javax.swing.UIManager;
|
||||||
import javax.swing.plaf.ComponentUI;
|
import javax.swing.plaf.ComponentUI;
|
||||||
import javax.swing.plaf.basic.BasicSeparatorUI;
|
import javax.swing.plaf.basic.BasicSeparatorUI;
|
||||||
import com.formdev.flatlaf.FlatClientProperties;
|
|
||||||
import com.formdev.flatlaf.ui.FlatStyleSupport.Styleable;
|
import com.formdev.flatlaf.ui.FlatStyleSupport.Styleable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -107,15 +106,8 @@ public class FlatSeparatorUI
|
|||||||
protected void installListeners( JSeparator s ) {
|
protected void installListeners( JSeparator s ) {
|
||||||
super.installListeners( s );
|
super.installListeners( s );
|
||||||
|
|
||||||
propertyChangeListener = e -> {
|
propertyChangeListener = FlatStyleSupport.createPropertyChangeListener(
|
||||||
switch( e.getPropertyName() ) {
|
s, style -> applyStyle( s, this, style ), null );
|
||||||
case FlatClientProperties.STYLE:
|
|
||||||
applyStyle( s, this, e.getNewValue() );
|
|
||||||
s.revalidate();
|
|
||||||
s.repaint();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
s.addPropertyChangeListener( propertyChangeListener );
|
s.addPropertyChangeListener( propertyChangeListener );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ import javax.swing.SwingUtilities;
|
|||||||
import javax.swing.UIManager;
|
import javax.swing.UIManager;
|
||||||
import javax.swing.plaf.ComponentUI;
|
import javax.swing.plaf.ComponentUI;
|
||||||
import javax.swing.plaf.basic.BasicSliderUI;
|
import javax.swing.plaf.basic.BasicSliderUI;
|
||||||
import com.formdev.flatlaf.FlatClientProperties;
|
|
||||||
import com.formdev.flatlaf.ui.FlatStyleSupport.Styleable;
|
import com.formdev.flatlaf.ui.FlatStyleSupport.Styleable;
|
||||||
import com.formdev.flatlaf.util.Graphics2DProxy;
|
import com.formdev.flatlaf.util.Graphics2DProxy;
|
||||||
import com.formdev.flatlaf.util.HiDPIUtils;
|
import com.formdev.flatlaf.util.HiDPIUtils;
|
||||||
@@ -185,18 +184,8 @@ public class FlatSliderUI
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected PropertyChangeListener createPropertyChangeListener( JSlider slider ) {
|
protected PropertyChangeListener createPropertyChangeListener( JSlider slider ) {
|
||||||
PropertyChangeListener superListener = super.createPropertyChangeListener( slider );
|
return FlatStyleSupport.createPropertyChangeListener( slider, this::applyStyle,
|
||||||
return e -> {
|
super.createPropertyChangeListener( slider ) );
|
||||||
superListener.propertyChange( e );
|
|
||||||
|
|
||||||
switch( e.getPropertyName() ) {
|
|
||||||
case FlatClientProperties.STYLE:
|
|
||||||
applyStyle( e.getNewValue() );
|
|
||||||
slider.revalidate();
|
|
||||||
slider.repaint();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ import javax.swing.UIManager;
|
|||||||
import javax.swing.plaf.ComponentUI;
|
import javax.swing.plaf.ComponentUI;
|
||||||
import javax.swing.plaf.basic.BasicSplitPaneDivider;
|
import javax.swing.plaf.basic.BasicSplitPaneDivider;
|
||||||
import javax.swing.plaf.basic.BasicSplitPaneUI;
|
import javax.swing.plaf.basic.BasicSplitPaneUI;
|
||||||
import com.formdev.flatlaf.FlatClientProperties;
|
|
||||||
import com.formdev.flatlaf.ui.FlatStyleSupport.Styleable;
|
import com.formdev.flatlaf.ui.FlatStyleSupport.Styleable;
|
||||||
import com.formdev.flatlaf.ui.FlatStyleSupport.UnknownStyleException;
|
import com.formdev.flatlaf.ui.FlatStyleSupport.UnknownStyleException;
|
||||||
import com.formdev.flatlaf.util.UIScale;
|
import com.formdev.flatlaf.util.UIScale;
|
||||||
@@ -117,15 +116,7 @@ public class FlatSplitPaneUI
|
|||||||
protected void installListeners() {
|
protected void installListeners() {
|
||||||
super.installListeners();
|
super.installListeners();
|
||||||
|
|
||||||
propertyChangeListener = e -> {
|
propertyChangeListener = FlatStyleSupport.createPropertyChangeListener( splitPane, this::applyStyle, null );
|
||||||
switch( e.getPropertyName() ) {
|
|
||||||
case FlatClientProperties.STYLE:
|
|
||||||
applyStyle( e.getNewValue() );
|
|
||||||
splitPane.revalidate();
|
|
||||||
splitPane.repaint();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
splitPane.addPropertyChangeListener( propertyChangeListener );
|
splitPane.addPropertyChangeListener( propertyChangeListener );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user