public class IconSetManager
extends java.lang.Object
IconSetManager
contains all the icon sets that you purchased 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 and Description |
---|
IconSetManager() |
Modifier and Type | Method and 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 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 overlayIconSize,
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.
|
public IconSet findIconSet(java.lang.String iconSetName)
iconSetName
- the icon set namepublic java.lang.String getActiveIconSetName()
getImageIcon(String)
method.public IconSet getActiveIconSet()
public void add(java.lang.String name, int[] sizes, java.lang.String packageName)
public void remove(java.lang.String name)
public void setActiveIconSetName(java.lang.String activeIconSetName)
activeIconSetName
- the new active icon set name.java.lang.IllegalArgumentException
- if the icon set is not found by that name.public javax.swing.ImageIcon getImageIcon(java.lang.String iconName)
iconName
- the icon name as defined in IconSet.public javax.swing.ImageIcon getImageIcon(java.lang.String iconName, int size)
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.public javax.swing.ImageIcon getOverlayImageIcon(java.lang.String iconName, int size, java.lang.String overlayIconName, int location)
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.public javax.swing.ImageIcon getOverlayImageIcon(java.lang.String iconName, int size, java.lang.String overlayIconName, int location, java.awt.Insets insets)
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.public javax.swing.ImageIcon getOverlayImageIcon(java.lang.String iconName, int size, java.lang.String overlayIconName, int overlayIconSize, int location, java.awt.Insets insets)
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.