mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 14:00:55 +03:00
Styling: add property change listener only for FlatLaf.style (where possible)
This commit is contained in:
@@ -28,6 +28,7 @@ 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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -110,14 +111,14 @@ public class FlatSeparatorUI
|
|||||||
|
|
||||||
propertyChangeListener = FlatStyleSupport.createPropertyChangeListener(
|
propertyChangeListener = FlatStyleSupport.createPropertyChangeListener(
|
||||||
s, style -> applyStyle( s, this, style ), null );
|
s, style -> applyStyle( s, this, style ), null );
|
||||||
s.addPropertyChangeListener( propertyChangeListener );
|
s.addPropertyChangeListener( FlatClientProperties.STYLE, propertyChangeListener );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void uninstallListeners( JSeparator s ) {
|
protected void uninstallListeners( JSeparator s ) {
|
||||||
super.uninstallListeners( s );
|
super.uninstallListeners( s );
|
||||||
|
|
||||||
s.removePropertyChangeListener( propertyChangeListener );
|
s.removePropertyChangeListener( FlatClientProperties.STYLE, propertyChangeListener );
|
||||||
propertyChangeListener = null;
|
propertyChangeListener = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ 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;
|
||||||
@@ -119,14 +120,14 @@ public class FlatSplitPaneUI
|
|||||||
super.installListeners();
|
super.installListeners();
|
||||||
|
|
||||||
propertyChangeListener = FlatStyleSupport.createPropertyChangeListener( splitPane, this::applyStyle, null );
|
propertyChangeListener = FlatStyleSupport.createPropertyChangeListener( splitPane, this::applyStyle, null );
|
||||||
splitPane.addPropertyChangeListener( propertyChangeListener );
|
splitPane.addPropertyChangeListener( FlatClientProperties.STYLE, propertyChangeListener );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void uninstallListeners() {
|
protected void uninstallListeners() {
|
||||||
super.uninstallListeners();
|
super.uninstallListeners();
|
||||||
|
|
||||||
splitPane.removePropertyChangeListener( propertyChangeListener );
|
splitPane.removePropertyChangeListener( FlatClientProperties.STYLE, propertyChangeListener );
|
||||||
propertyChangeListener = null;
|
propertyChangeListener = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user