Package com.jidesoft.icons
Class IconSetManager
java.lang.Object
com.jidesoft.icons.IconSetManager
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 -
Method Summary
Modifier and TypeMethodDescriptionvoid
findIconSet
(String iconSetName) finds the icon set if it is available.gets the active icon set.Gets the active icon set name.getImageIcon
(String iconName) Gets the ImageIcon.getImageIcon
(String iconName, int size) Gets the ImageIcon.getOverlayImageIcon
(String iconName, int size, String overlayIconName, int location) Gets the ImageIcon.getOverlayImageIcon
(String iconName, int size, String overlayIconName, int overlayIconSize, int location, Insets insets) Gets the ImageIcon with an overlay icon on it.getOverlayImageIcon
(String iconName, int size, String overlayIconName, int location, Insets insets) Gets the ImageIcon with an overlay icon on it.void
void
setActiveIconSetName
(String activeIconSetName) Sets the active icon set name.
-
Constructor Details
-
IconSetManager
public IconSetManager()
-
-
Method Details
-
findIconSet
finds the icon set if it is available.- Parameters:
iconSetName
- the icon set name- Returns:
- the icon set. Null if not found.
-
getActiveIconSetName
Gets the active icon set name. The active icon set will be used when you callgetImageIcon(String)
method.- Returns:
- the active icon set name.
-
getActiveIconSet
gets the active icon set.- Returns:
- the active icon set.
-
add
-
remove
-
setActiveIconSetName
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:
IllegalArgumentException
- if the icon set is not found by that name.
-
getImageIcon
Gets the ImageIcon.- Parameters:
iconName
- the icon name as defined in IconSet.- Returns:
- the ImageIcon.
-
getImageIcon
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 ImageIcon getOverlayImageIcon(String iconName, int size, 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 ImageIcon getOverlayImageIcon(String iconName, int size, String overlayIconName, int location, 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 ImageIcon getOverlayImageIcon(String iconName, int size, String overlayIconName, int overlayIconSize, int location, 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.
-