Package org.jorigin.gui
Class IconLoader
- java.lang.Object
-
- org.jorigin.gui.IconLoader
-
public class IconLoader extends java.lang.ObjectA class dedicated to the load of icons. This class enable to seek icons from a given directory and enable to scale icons in metric units.- Since:
- 1.0.3
- Version:
- "1.0.8" - b201801141330L
- Author:
- Julien Seinturier - COMEX S.A. - contact@jorigin.org - https://github.com/jorigin/jeometry
-
-
Constructor Summary
Constructors Constructor Description IconLoader()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static javax.swing.ImageIcongetIcon(java.lang.String path)Get aniconfrom the givenpath.static java.lang.StringgetIconPath()Get the path to use as root for the icon search.static java.awt.ImagegetImage(java.lang.String path)Get animagefrom the givenpath.static javax.swing.ImageIcongetScaledIcon(java.lang.String name, java.awt.Dimension dimension)Get an icon and scale it to the desired size given in millimeters.static voidsetIconPath(java.lang.String path)Set the path to use as root for the icon search.
-
-
-
Method Detail
-
getIcon
public static javax.swing.ImageIcon getIcon(java.lang.String path)
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.
-
getImage
public static java.awt.Image getImage(java.lang.String path)
Get animagefrom the givenpath. If the imagepathis relative, a complete path is created by concatenating theimage root pathand the given one. If the imagepathis absolute, the image is directly loaded.- Parameters:
path- the path to the image. Can be relative or absolute.- Returns:
- the loaded image or
nullif no image was found.
-
getScaledIcon
public static javax.swing.ImageIcon getScaledIcon(java.lang.String name, java.awt.Dimension dimension)Get an icon and scale it to the desired size given in millimeters.- Parameters:
name- the name of the icon to load.dimension- the dimension in millimeters of the icon.- Returns:
- a scaled image that represents the desired icon.
-
getIconPath
public static java.lang.String getIconPath()
Get the path to use as root for the icon search.- Returns:
- the path to use as root for the icon search.
- See Also:
setIconPath(String)
-
setIconPath
public static void setIconPath(java.lang.String path)
Set the path to use as root for the icon search.- Parameters:
path- the path to use as root for the icon search.- See Also:
getIconPath()
-
-