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 3cfb418f..9b17d130 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 @@ -170,6 +170,69 @@ public class FlatSVGIcon this.classLoader = classLoader; } + /** + * Returns the name of the SVG resource (a '/'-separated path). + * + * @since 1.2 + */ + public String getName() { + return name; + } + + /** + * Returns the custom icon width specified in {@link #FlatSVGIcon(String, int, int)}, + * {@link #FlatSVGIcon(String, int, int, ClassLoader)} or {@link #derive(int, int)}. + * Otherwise {@code -1} is returned. + *
+ * To get the painted icon width, use {@link #getIconWidth()}. + * + * @since 1.2 + */ + public int getWidth() { + return width; + } + + /** + * Returns the custom icon height specified in {@link #FlatSVGIcon(String, int, int)}, + * {@link #FlatSVGIcon(String, int, int, ClassLoader)} or {@link #derive(int, int)}. + * Otherwise {@code -1} is returned. + *
+ * To get the painted icon height, use {@link #getIconHeight()}.
+ *
+ * @since 1.2
+ */
+ public int getHeight() {
+ return height;
+ }
+
+ /**
+ * Returns the amount by which the icon size is scaled. Usually {@code 1}.
+ *
+ * @since 1.2
+ */
+ public float getScale() {
+ return scale;
+ }
+
+ /**
+ * Returns whether the icon is pained in "disabled" state.
+ *
+ * @see #getDisabledIcon()
+ * @since 1.2
+ */
+ public boolean isDisabled() {
+ return disabled;
+ }
+
+ /**
+ * Returns the class loader used to load the SVG resource.
+ *
+ * @since 1.2
+ */
+ public ClassLoader getClassLoader() {
+ return classLoader;
+ }
+
/**
* Creates a new icon with given width and height, which is derived from this icon.
*
@@ -181,7 +244,7 @@ public class FlatSVGIcon
if( width == this.width && height == this.height )
return this;
- FlatSVGIcon icon = new FlatSVGIcon( name, width, height, scale, false, classLoader );
+ FlatSVGIcon icon = new FlatSVGIcon( name, width, height, scale, disabled, classLoader );
icon.diagram = diagram;
icon.dark = dark;
return icon;
@@ -197,7 +260,7 @@ public class FlatSVGIcon
if( scale == this.scale )
return this;
- FlatSVGIcon icon = new FlatSVGIcon( name, width, height, scale, false, classLoader );
+ FlatSVGIcon icon = new FlatSVGIcon( name, width, height, scale, disabled, classLoader );
icon.diagram = diagram;
icon.dark = dark;
return icon;
@@ -448,8 +511,8 @@ public class FlatSVGIcon
{
private static ColorFilter instance;
- private final Map