Class IconLoader
java.lang.Object
org.jorigin.jfx.icon.IconLoader
A class dedicated to JavaFX icon loading.
- Author:
- Julien SEINTURIER, IVM Technologies / j.seinturier@ivm-technologies.com
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic intThis flag identifies a jar type for the resource path.static intThis flag identifies a zip type for the resource path.static intThis flag identifies an filesystem type (absolute) for the resource path.static intThis flag identifies an unknown type for the resource path.static intThis flag identifies an URL type (HTTP, HTTPS, FTP, SFTP) for the resource path. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic javafx.scene.image.ImageGet aniconfrom the givenpath.static StringGet the directory to use as root for the icon search.static javafx.scene.image.ImagegetScaledIcon(String name, double width, double height) Get an icon and scale it to the desired size given in millimeters.static javafx.scene.image.ImagegetScaledIcon(String name, javafx.geometry.Dimension2D dimension) Get an icon and scale it to the desired size given in millimeter (mm)static javafx.scene.image.ImageViewgetScaledIconView(String name, javafx.geometry.Dimension2D dimension) Get an icon as animage viewand scale it to the desired size given in millimeter (mm)static voidsetIconDirectory(String path) Set the path to use as root for the icon search.
-
Field Details
-
PATH_TYPE_UNKNOWN
public static int PATH_TYPE_UNKNOWNThis flag identifies an unknown type for the resource path. -
PATH_TYPE_FILESYSTEM
public static int PATH_TYPE_FILESYSTEMThis flag identifies an filesystem type (absolute) for the resource path. -
PATH_TYPE_URL
public static int PATH_TYPE_URLThis flag identifies an URL type (HTTP, HTTPS, FTP, SFTP) for the resource path. -
PATH_TYPE_EMBEDDED_JAR
public static int PATH_TYPE_EMBEDDED_JARThis flag identifies a jar type for the resource path. -
PATH_TYPE_EMBEDDED_ZIP
public static int PATH_TYPE_EMBEDDED_ZIPThis flag identifies a zip type for the resource path.
-
-
Constructor Details
-
IconLoader
public IconLoader()
-
-
Method Details
-
getIcon
Get aniconfrom the givenpath. If the iconpathis relative, a complete path is created by concatenating theicon root pathand the given one. If the iconpathis absolute, the icon is directly loaded.- Parameters:
path- the path to the icon. Can be relative or absolute.- Returns:
- the loaded icon or
nullif no icon was found.
-
getScaledIconView
public static javafx.scene.image.ImageView getScaledIconView(String name, javafx.geometry.Dimension2D dimension) Get an icon as animage viewand scale it to the desired size given in millimeter (mm)- Parameters:
name- the name of the icon to loaddimension- 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 loaddimension- the dimension in millimeter (mm) of the icon- Returns:
- a scaled image that represents the desired icon
- See Also:
-
getScaledIcon
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
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
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:
-