Package swingtree.api

Enum Class IconDeclaration.SourceFormat

java.lang.Object
java.lang.Enum<IconDeclaration.SourceFormat>
swingtree.api.IconDeclaration.SourceFormat
All Implemented Interfaces:
Serializable, Comparable<IconDeclaration.SourceFormat>, Constable
Enclosing interface:
IconDeclaration

public static enum IconDeclaration.SourceFormat extends Enum<IconDeclaration.SourceFormat>
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.

  • Enum Constant Details

    • PATH_TO_ICON

      public static final IconDeclaration.SourceFormat 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
      The file format can be any image format supported by Java's ImageIcon class (PNG, JPEG, etc.).
    • SVG_STRING

      public static final IconDeclaration.SourceFormat 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

      public static IconDeclaration.SourceFormat[] 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

      public static IconDeclaration.SourceFormat valueOf(String name)
      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 name
      NullPointerException - if the argument is null