Module org.jcommon

Class IconLoader

    • Constructor Detail

      • IconLoader

        public IconLoader()
    • Method Detail

      • getIcon

        public static ImageIcon 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.
      • getImage

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

        public static ImageIcon getScaledIcon​(String name,
                                              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 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​(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()