|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.levigo.util.swing.IconManager
public class IconManager
The IconManager
manages a set of Icon
s. Icon sets consist of an
icon property file in conjunction with an icon image. The icon image may contain a large number
of icons in one convenient and efficient image file. The icons may be arranged in a grid-fashion
within the image file, but this is not a requirement. The position and size of the icons within
the image file is specified through the icon properties.
The icon properties file consists of two types of entries:
The second type of entry specifies the position of a single icon within the icon image as a tuple
of coordinates. The coordinates are specified in the format x, y, width, height
.
An application may use any number of icon sets. For eact icon set an instance of
IconManager
must be used. The instances of icon managers are managed statically by
this class. Individual instances must be retrieved using the
getInstance(Class, String)
method.
Nested Class Summary | |
---|---|
class |
IconManager.IconManagerIcon
The IconManager.IconManagerIcon.AccessibleIconManagerIcon implementation used for icons created by the icon manager. |
Field Summary | |
---|---|
static int |
AUTO_DISABLE
Flag indicating that the Icon should automatically draw itself disabled when its enclosing component is disabled |
static int |
AUTO_ROLLOVER
Flag indicating that the Icon should automatically produce a rollover version of itself. |
static int |
EFFECT_ALPHA50P
Icon effect: make icon 50% transparent |
static int |
EFFECT_DARKER
Icon effect draw icon darker |
static int |
EFFECT_GRAY
Icon effect: convert to gray (desaturate) |
static int |
EFFECT_GRAY50P
Icon effect: convert to gray (desaturate) partially (50%) |
static int |
EFFECT_LIGHTER
Icon effect: draw icon lighter |
static int |
EFFECT_MORECONTRAST
Icon effect: make icon 50% transparent |
static int |
ROTATE_180
Rotate the icon by 180 degrees |
static int |
ROTATE_270
Rotate the icon by 270 degrees |
static int |
ROTATE_90
Rotate the icon by 90 degrees |
Method Summary | |
---|---|
protected BufferedImage |
applyOp(BufferedImage src,
BufferedImageOp op)
|
Collection<String> |
getAllKeys()
Return all icon keys. |
int |
getAutoDisableFlags()
Gets the autoDisableFlags. |
int |
getAutoRolloverFlags()
Gets the autoRolloverFlags. |
Icon |
getCompositeIcon(String[] layers)
Get the IconManager.IconManagerIcon for a given set of layers (names of icons representing the layers). |
Icon |
getCompositeIcon(String[] layers,
int effectFlags,
Dimension targetSize)
Get the IconManager.IconManagerIcon for a given set of layers (names of icons representing the layers) and a
set of effect flags scaled to a given dimension. |
int |
getDefaultEffects()
Gets the default effects. |
Icon |
getIcon(String name)
Get the IconManager.IconManagerIcon for a given name. |
Icon |
getIcon(String name,
int effectFlags)
Get the IconManager.IconManagerIcon for a given name. |
Icon |
getIcon(String name,
int effectFlags,
Dimension targetSize)
Get the IconManager.IconManagerIcon for a given name and a set of effect flags scaled to a given dimension. |
Image |
getImage(String name)
Get the Image of an icon instead of the icon itself. |
Image |
getImage(String name,
int effectFlags)
Get the Image of an icon instead of the icon itself. |
protected Image |
getImageForEffect(int effect)
Get the image instance for a particular set of effect flags. |
static IconManager |
getInstance(Class<?> loadClass,
String iconSetName)
Factory method: get an IconManager instance for the specified icon set name. |
static IconManager |
getInstance(String iconSetName)
Factory method: get an IconManager instance for the specified icon set name. |
void |
setAutoDisableFlags(int autoDisableFlags)
Sets the autoDisableFlags. |
void |
setAutoRolloverFlags(int autoRolloverFlags)
Sets the autoRolloverFlags. |
void |
setDefaultEffects(int defaultEffects)
Sets the default effects. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int AUTO_DISABLE
public static final int AUTO_ROLLOVER
public static final int EFFECT_GRAY
public static final int EFFECT_GRAY50P
public static final int EFFECT_LIGHTER
public static final int EFFECT_DARKER
public static final int EFFECT_ALPHA50P
public static final int EFFECT_MORECONTRAST
public static final int ROTATE_90
public static final int ROTATE_180
public static final int ROTATE_270
Method Detail |
---|
public static IconManager getInstance(String iconSetName)
iconSetName
- the name of the icon set
null
if the icon manager could not be instantiated
(e.g. because the file could not be found)public static IconManager getInstance(Class<?> loadClass, String iconSetName)
loadClass
- the class relative to which to look for the icon properties and image file.iconSetName
- the name of the icon set
null
if the icon manager could not be instantiated
(e.g. because the file could not be found)public Icon getIcon(String name)
IconManager.IconManagerIcon
for a given name. The Icon will have no SFX.
name
- the icon's name.
null
if the icon wasn't found.public Icon getIcon(String name, int effectFlags)
IconManager.IconManagerIcon
for a given name. The Icon will have the specified effects.
name
- the icon's name.effectFlags
- an ORed combination of a set of effect flags.
null
if the icon wasn't found.AUTO_DISABLE
,
AUTO_ROLLOVER
,
EFFECT_ALPHA50P
,
EFFECT_DARKER
,
EFFECT_LIGHTER
,
EFFECT_GRAY
public Icon getIcon(String name, int effectFlags, Dimension targetSize)
IconManager.IconManagerIcon
for a given name and a set of effect flags scaled to a given dimension.
name
- the icon's name.effectFlags
- an ORed combination of a set of effect flags.targetSize
- the size of the resulting icon
null
if the icon wasn't found.AUTO_DISABLE
,
AUTO_ROLLOVER
,
EFFECT_ALPHA50P
,
EFFECT_DARKER
,
EFFECT_LIGHTER
,
EFFECT_GRAY
public Collection<String> getAllKeys()
public Icon getCompositeIcon(String[] layers, int effectFlags, Dimension targetSize)
IconManager.IconManagerIcon
for a given set of layers (names of icons representing the layers) and a
set of effect flags scaled to a given dimension. The Icon will be composited of the given
layers with the first layer specified being the first to be painted, i.e. the layers are
specified in back-to-front order.
In order to facilitate the usage, entries of the layers array may be null
in order
to leave the layer blank.
layers
- the icon's layers.effectFlags
- an ORed combination of a set of effect flags.targetSize
- the size of the resulting icon
null
if the icon wasn't found.AUTO_DISABLE
,
AUTO_ROLLOVER
,
EFFECT_ALPHA50P
,
EFFECT_DARKER
,
EFFECT_LIGHTER
,
EFFECT_GRAY
public Icon getCompositeIcon(String[] layers)
IconManager.IconManagerIcon
for a given set of layers (names of icons representing the layers). The
Icon will be composited of the given layers with the first layer specified being the first to
be painted, i.e. the layers are specified in back-to-front order.
In order to facilitate the usage, entries of the layers array may be null
in order
to leave the layer blank.
layers
- the icon's layers.
null
if the icon wasn't found.public Image getImage(String name, int effectFlags)
Image
of an icon instead of the icon itself.
name
- the icon's name.effectFlags
- an ORed combination of a set of effect flags.
null
if the icon wasn't found.AUTO_DISABLE
,
AUTO_ROLLOVER
,
EFFECT_ALPHA50P
,
EFFECT_DARKER
,
EFFECT_LIGHTER
,
EFFECT_GRAY
public Image getImage(String name)
Image
of an icon instead of the icon itself.
name
- the icon's name.
null
if the icon wasn't found.protected Image getImageForEffect(int effect)
effect
- an ORed combination of a set of effect flags
EFFECT_ALPHA50P
,
EFFECT_DARKER
,
EFFECT_LIGHTER
,
EFFECT_GRAY
protected BufferedImage applyOp(BufferedImage src, BufferedImageOp op)
public int getAutoDisableFlags()
public void setAutoDisableFlags(int autoDisableFlags)
autoDisableFlags
- The autoDisableFlags to setpublic int getAutoRolloverFlags()
public void setAutoRolloverFlags(int autoRolloverFlags)
autoRolloverFlags
- The autoRolloverFlags to setpublic int getDefaultEffects()
public void setDefaultEffects(int defaultEffects)
defaultEffects
- The defaultEffects to set
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |