Class IconLoader

java.lang.Object
org.jorigin.jfx.icon.IconLoader

public final class IconLoader extends Object
A class dedicated to JavaFX icon loading.
Author:
Julien SEINTURIER, IVM Technologies / j.seinturier@ivm-technologies.com
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static int
    This flag identifies a jar type for the resource path.
    static int
    This flag identifies a zip type for the resource path.
    static int
    This flag identifies an filesystem type (absolute) for the resource path.
    static int
    This flag identifies an unknown type for the resource path.
    static int
    This flag identifies an URL type (HTTP, HTTPS, FTP, SFTP) for the resource path.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static javafx.scene.image.Image
    Get an icon from the given path.
    static String
    Get the directory to use as root for the icon search.
    static javafx.scene.image.Image
    getScaledIcon(String name, double width, double height)
    Get an icon and scale it to the desired size given in millimeters.
    static javafx.scene.image.Image
    getScaledIcon(String name, javafx.geometry.Dimension2D dimension)
    Get an icon and scale it to the desired size given in millimeter (mm)
    static javafx.scene.image.ImageView
    getScaledIconView(String name, javafx.geometry.Dimension2D dimension)
    Get an icon as an image view and scale it to the desired size given in millimeter (mm)
    static void
    Set the path to use as root for the icon search.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • PATH_TYPE_UNKNOWN

      public static int PATH_TYPE_UNKNOWN
      This flag identifies an unknown type for the resource path.
    • PATH_TYPE_FILESYSTEM

      public static int PATH_TYPE_FILESYSTEM
      This flag identifies an filesystem type (absolute) for the resource path.
    • PATH_TYPE_URL

      public static int PATH_TYPE_URL
      This flag identifies an URL type (HTTP, HTTPS, FTP, SFTP) for the resource path.
    • PATH_TYPE_EMBEDDED_JAR

      public static int PATH_TYPE_EMBEDDED_JAR
      This flag identifies a jar type for the resource path.
    • PATH_TYPE_EMBEDDED_ZIP

      public static int PATH_TYPE_EMBEDDED_ZIP
      This flag identifies a zip type for the resource path.
  • Constructor Details

    • IconLoader

      public IconLoader()
  • Method Details

    • getIcon

      public static javafx.scene.image.Image getIcon(String path)
      Get an icon from the given path. If the icon path is relative, a complete path is created by concatenating the icon root path and the given one. If the icon path is absolute, the icon is directly loaded.
      Parameters:
      path - the path to the icon. Can be relative or absolute.
      Returns:
      the loaded icon or null if no icon was found.
    • getScaledIconView

      public static javafx.scene.image.ImageView getScaledIconView(String name, javafx.geometry.Dimension2D dimension)
      Get an icon as an image view and scale it to the desired size given in millimeter (mm)
      Parameters:
      name - the name of the icon to load
      dimension - the dimension in millimeter (mm) of the icon
      Returns:
      a scaled image view that represents the desired icon
      See Also:
    • getScaledIcon

      public static javafx.scene.image.Image getScaledIcon(String name, javafx.geometry.Dimension2D dimension)
      Get an icon and scale it to the desired size given in millimeter (mm)
      Parameters:
      name - the name of the icon to load
      dimension - the dimension in millimeter (mm) of the icon
      Returns:
      a scaled image that represents the desired icon
      See Also:
    • getScaledIcon

      public static javafx.scene.image.Image getScaledIcon(String name, double width, double height)
      Get an icon and scale it to the desired size given in millimeters.
      Parameters:
      name - the name of the icon to load.
      width - the expected width in millimeter (mm)
      height - the expected height in millimeter (mm)
      Returns:
      a scaled image that represents the desired icon
      See Also:
    • getIconDirectory

      public static String getIconDirectory()
      Get the directory to use as root for the icon search. The icon path can be a system directory, a string that represents an URL or a string that represents an embedded (zip, jar, ...) directory.
      Returns:
      the path to use as root for the icon search.
      See Also:
    • setIconDirectory

      public static void setIconDirectory(String path)
      Set the path to use as root for the icon search. The icon path can be a system directory, a string that represents an URL or a string that represents an embedded (zip, jar, ...) directory.
      Parameters:
      path - the path to use as root for the icon search.
      See Also: