diff --git a/CHANGELOG.md b/CHANGELOG.md index 25db3dec..f0d13c9c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ FlatLaf Change Log - ToolTip: Fixed wrong tooltip location if component overrides `JComponent.getToolTipLocation()` and wants place tooltip under mouse location. (issue #468) +- Extras: Added copy constructor to `FlatSVGIcon`. (issue #465) ## 2.0 diff --git a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/FlatSVGIcon.java b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/FlatSVGIcon.java index 3a35f803..ed5792c1 100644 --- a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/FlatSVGIcon.java +++ b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/FlatSVGIcon.java @@ -284,6 +284,20 @@ public class FlatSVGIcon } } + /** + * Creates a copy of the given icon. + *
+ * If the icon has a color filter, then it is shared with the new icon. + * + * @since 2.0.1 + */ + public FlatSVGIcon( FlatSVGIcon icon ) { + this( icon.name, icon.width, icon.height, icon.scale, icon.disabled, icon.classLoader, icon.uri ); + colorFilter = icon.colorFilter; + diagram = icon.diagram; + dark = icon.dark; + } + protected FlatSVGIcon( String name, int width, int height, float scale, boolean disabled, ClassLoader classLoader, URI uri ) { this.name = name; this.width = width;