public abstract class GifResource extends Object
getIcon(Class),
which returns the icon associated with the given class.
The class must be a subclass of GifResource as is Open.
That class is also an example for using GifResources:
Just derive a class from GifResource
and put it into a package
(org.javalobby.icons16x16 in this case)
pointing to the according gif-image
which can be found in this case
in src/main/resources/org/javalobby/icons16x16/Open.gif.
Created: Sun Jun 4 20:50:12 2006| Modifier and Type | Field and Description |
|---|---|
private static String |
CLASS
target/classes/: the directory of the classfiles
within the simuline-developing environment.
**** bad: path is hardcoded **** |
private static String |
CLASS_END
The ending of a java class file.
|
private static String |
GIF_END
The ending of a gif file.
|
private static Map<Class<?>,ImageIcon> |
GIFS
A cache for gif-files represented by GifResources.
|
private static String |
RESOURCE
src/main/resource/: the directory of the resources
within simuline-developing environment.
**** bad: path is hardcoded **** |
private static String |
URL_SEP
The separator in urls.
|
| Constructor and Description |
|---|
GifResource() |
| Modifier and Type | Method and Description |
|---|---|
static ImageIcon |
getIcon(Class<? extends GifResource> res)
Converts a GifResource class into the corresponding icon.
|
static void |
main(String[] args) |
private static final String URL_SEP
private static final String CLASS_END
private static final String GIF_END
private static final String CLASS
target/classes/: the directory of the classfiles
within the simuline-developing environment.
**** bad: path is hardcoded ****private static final String RESOURCE
src/main/resource/: the directory of the resources
within simuline-developing environment.
**** bad: path is hardcoded ****public static ImageIcon getIcon(Class<? extends GifResource> res)
GIFS, take this one.
Else load it into GIFSas described below
before taking it from GIFS.
Loading an image consists in loading the class-file associated with the image, determining the according gif-file and creating the according ImageIcon.
res - a subclass of GifResource.
CAUTION: Note that an icon is returned
even if there is no according gif-image.
This image can be identified by width -1
which is an undocumented property.
public static final void main(String[] args)
Copyright © 2012–2018 Simuline Organization (l2r). All rights reserved.