public class IconResource
extends javax.swing.ImageIcon
ClassLoader.getResource(). The main value of this class is that, unlike standard
ImageIcons, it can be successfully serialized as XML by WidgetEncoder.
Because the image is specified by a relative path, it will be found when the XML is decoded,
regardless of where the application is stored on the computer.| Constructor and Description |
|---|
IconResource(java.lang.String resourceName)
Create an IconResource by loading an image file out of the classpath.
|
IconResource(java.lang.String resourceName,
java.lang.ClassLoader classloader)
Create an IconResource by loading an image file out of the classpath.
|
IconResource(java.lang.String resourceName,
java.lang.String description)
Create an IconResource by loading an image file out of the classpath.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getResourceName()
Get the icon's resource name.
|
public IconResource(java.lang.String resourceName)
resourceName - the name of the resource to load (by passing it to ClassLoader.getResource())public IconResource(java.lang.String resourceName,
java.lang.String description)
resourceName - the name of the resource to load (by passing it to Class.getResource())description - a brief description of the imagepublic IconResource(java.lang.String resourceName,
java.lang.ClassLoader classloader)
resourceName - the name of the resource to load (by passing it to ClassLoader.getResource())classloader - the ClassLoader with which to load the resourceWritten by Peter Eastman.