Package swingtree.api
Enum Class IconDeclaration.SourceFormat
- All Implemented Interfaces:
Serializable,Comparable<IconDeclaration.SourceFormat>,Constable
- Enclosing interface:
IconDeclaration
Defines the format of the source string returned by
IconDeclaration.source().
This enum determines how the source string should be interpreted
when loading or creating an icon.
For example, a source string could be a file path pointing to a PNG or JPEG image file, or it could be a complete SVG document in XML text form.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe source string is a path to an icon file.The source string is a complete SVG document in XML text form. -
Method Summary
Modifier and TypeMethodDescriptionstatic IconDeclaration.SourceFormatReturns the enum constant of this class with the specified name.static IconDeclaration.SourceFormat[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
PATH_TO_ICON
The source string is a path to an icon file. This path can be either:- A relative path resolved against the classpath
- An absolute file system path
ImageIconclass (PNG, JPEG, etc.). -
SVG_STRING
The source string is a complete SVG document in XML text form. This allows for programmatic creation of vector icons without needing external files.Example:
String svg = "<svg width='16' height='16'><circle cx='8' cy='8' r='6' fill='red'/></svg>"; IconDeclaration.ofSvg(svg);
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-