public class ImageParser
extends java.lang.Object
BufferedImage
instances from string representations. Each
image is loaded only once.Modifier and Type | Field and Description |
---|---|
private JXCSkinCache<java.awt.image.BufferedImage> |
definedImages
All defined images.
|
private JXCSkinSource |
skinSource
The
JXCSkinSource for loading resources. |
Constructor and Description |
---|
ImageParser(JXCSkinSource skinSource)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Forgets all defined images.
|
java.awt.Image |
getImage(java.awt.Color color,
java.lang.String name)
Optionally loads an image by base file name.
|
java.awt.image.BufferedImage |
getImage(java.lang.String name)
Loads an image by base file name.
|
@NotNull private final JXCSkinCache<java.awt.image.BufferedImage> definedImages
@NotNull private final JXCSkinSource skinSource
JXCSkinSource
for loading resources.public ImageParser(@NotNull JXCSkinSource skinSource)
skinSource
- the skin source for loading resourcespublic void clear()
@Nullable public java.awt.Image getImage(@Nullable java.awt.Color color, @NotNull java.lang.String name) throws java.io.IOException
color
- if non-null
, return null
name
- the base file namenull
if color!=null
java.io.IOException
- if the image cannot be loaded@NotNull public java.awt.image.BufferedImage getImage(@NotNull java.lang.String name) throws java.io.IOException
name
- the base file namejava.io.IOException
- if the image cannot be loaded