Class IconSetManager


  • public class IconSetManager
    extends java.lang.Object
    IconSetManager contains all the JIDE icon sets in one class so that you can access all of them from one single place and switch to different icon set just by calling setActiveIconSetName(String).

    In order to use IconSetManager, you need to define and register the JIDE icon set first. You can do something like this.

     public static IconSetManager ICON_SET_MANAGER = new IconSetManager();
     

    static { ICON_SET_MANAGER.add("vista", new int[]{16, 24, 32, 48, 64, 96, 128, 256}, "/com/jidesoft/icons/vista"); ICON_SET_MANAGER.add("xp", new int[]{16, 24, 32, 48, 64}, "/com/jidesoft/icons/xp"); // add more if you have. Right now JIDE only provides one icon set but we will add more }

    Later on if you want to use it, for example, to get a File-New icon, you just call
     ICON_SET_MANAGER.getImageIcon(IconSet.File.NEW, size);
     
    The size is the size you want such as 16, 24, 32, 48, or 64 depending on what sizes are available.
    • Constructor Summary

      Constructors 
      Constructor Description
      IconSetManager()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(java.lang.String name, int[] sizes, java.lang.String packageName)  
      IconSet findIconSet​(java.lang.String iconSetName)
      finds the icon set if it is available.
      IconSet getActiveIconSet()
      gets the active icon set.
      java.lang.String getActiveIconSetName()
      Gets the active icon set name.
      javax.swing.ImageIcon getImageIcon​(java.lang.String iconName)
      Gets the ImageIcon.
      javax.swing.ImageIcon getImageIcon​(java.lang.String iconName, int size)
      Gets the ImageIcon.
      javax.swing.ImageIcon getOverlayImageIcon​(java.lang.String iconName, int size, java.lang.String overlayIconName, int location)
      Gets the ImageIcon.
      javax.swing.ImageIcon getOverlayImageIcon​(java.lang.String iconName, int size, java.lang.String overlayIconName, int overlayIconSize, int location, java.awt.Insets insets)
      Gets the ImageIcon with an overlay icon on it.
      javax.swing.ImageIcon getOverlayImageIcon​(java.lang.String iconName, int size, java.lang.String overlayIconName, int location, java.awt.Insets insets)
      Gets the ImageIcon with an overlay icon on it.
      void remove​(java.lang.String name)  
      void setActiveIconSetName​(java.lang.String activeIconSetName)
      Sets the active icon set name.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IconSetManager

        public IconSetManager()
    • Method Detail

      • findIconSet

        public IconSet findIconSet​(java.lang.String iconSetName)
        finds the icon set if it is available.
        Parameters:
        iconSetName - the icon set name
        Returns:
        the icon set. Null if not found.
      • getActiveIconSetName

        public java.lang.String getActiveIconSetName()
        Gets the active icon set name. The active icon set will be used when you call getImageIcon(String) method.
        Returns:
        the active icon set name.
      • getActiveIconSet

        public IconSet getActiveIconSet()
        gets the active icon set.
        Returns:
        the active icon set.
      • add

        public void add​(java.lang.String name,
                        int[] sizes,
                        java.lang.String packageName)
      • remove

        public void remove​(java.lang.String name)
      • setActiveIconSetName

        public void setActiveIconSetName​(java.lang.String activeIconSetName)
        Sets the active icon set name. If the icon set is not found, IllegalArgumentException will be thrown.
        Parameters:
        activeIconSetName - the new active icon set name.
        Throws:
        java.lang.IllegalArgumentException - if the icon set is not found by that name.
      • getImageIcon

        public javax.swing.ImageIcon getImageIcon​(java.lang.String iconName)
        Gets the ImageIcon.
        Parameters:
        iconName - the icon name as defined in IconSet.
        Returns:
        the ImageIcon.
      • getImageIcon

        public javax.swing.ImageIcon getImageIcon​(java.lang.String iconName,
                                                  int size)
        Gets the ImageIcon.
        Parameters:
        iconName - the icon name as defined in IconSet.
        size - the icon size. If the size is not available, it will find the closest size that is larger than the requested size.
        Returns:
        the ImageIcon.
      • getOverlayImageIcon

        public javax.swing.ImageIcon getOverlayImageIcon​(java.lang.String iconName,
                                                         int size,
                                                         java.lang.String overlayIconName,
                                                         int location)
        Gets the ImageIcon.
        Parameters:
        iconName - the icon name as defined in IconSet.
        size - the icon size. If the size is not available, it will find the closest size that is larger than the requested size.
        overlayIconName - the overlay icon name as defined in IconSet.
        location - the location as defined in SwingConstants - CENTER, NORTH, SOUTH, WEST, EAST, NORTH_EAST, NORTH_WEST, SOUTH_WEST and SOUTH_EAST.
        Returns:
        the ImageIcon.
      • getOverlayImageIcon

        public javax.swing.ImageIcon getOverlayImageIcon​(java.lang.String iconName,
                                                         int size,
                                                         java.lang.String overlayIconName,
                                                         int location,
                                                         java.awt.Insets insets)
        Gets the ImageIcon with an overlay icon on it.
        Parameters:
        iconName - the icon name as defined in IconSet.
        size - the icon size. If the size is not available, it will find the closest size that is larger than the requested size.
        overlayIconName - the overlay icon name as defined in IconSet. The icons in the Overlay category are half the size of the regular icons. So this method will take the middle portion of the overlay icon specified in the overlayIconName and use it as the overlay icon.
        location - the location as defined in SwingConstants - CENTER, NORTH, SOUTH, WEST, EAST, NORTH_EAST, NORTH_WEST, SOUTH_WEST and SOUTH_EAST.
        insets - the margin of the overlay icon to the border of the icon.
        Returns:
        the ImageIcon.
      • getOverlayImageIcon

        public javax.swing.ImageIcon getOverlayImageIcon​(java.lang.String iconName,
                                                         int size,
                                                         java.lang.String overlayIconName,
                                                         int overlayIconSize,
                                                         int location,
                                                         java.awt.Insets insets)
        Gets the ImageIcon with an overlay icon on it.
        Parameters:
        iconName - the icon name as defined in IconSet.
        size - the icon size. If the size is not available, it will find the closest size that is larger than the requested size.
        overlayIconName - the overlay icon name as defined in IconSet. The overlay icon doesn't have to be in the overlay category. It can be any regular icon. Of course the size of the overlay icon should be smaller than the size of the regular icon.
        overlayIconSize - the size of the overlay icon.
        location - the location as defined in SwingConstants - CENTER, NORTH, SOUTH, WEST, EAST, NORTH_EAST, NORTH_WEST, SOUTH_WEST and SOUTH_EAST.
        insets - the margin of the overlay icon to the border of the icon.
        Returns:
        the ImageIcon.