public class IconHandler
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected boolean |
debug
The debug flag
|
protected static IconHandler |
defaultIconHandler
The default icon handler - construct one with no resources
|
protected java.util.PropertyResourceBundle |
resources
The resource bundle for the icon handler
|
Constructor and Description |
---|
IconHandler()
Create an icon handler
|
IconHandler(java.util.PropertyResourceBundle resources)
Create an icon handler with a property file which holds the mapping of
icon names to resources.
|
Modifier and Type | Method and Description |
---|---|
java.awt.Cursor |
buildCursorByName(java.lang.String name,
java.awt.Point hotspot)
Builds a cursor from the named gif image
|
static IconHandler |
getDefaultIconHandler()
Gets the default icon handler
|
javax.swing.Icon |
getGrayIcon(javax.swing.Icon icon)
Gets a gray version of an icon.
|
protected boolean |
isDark(int rgb)
Determines whether an RGB value is dark for graying out an image.
|
javax.swing.Icon |
loadIconById(java.lang.String id)
This method loads an icon using an identifier.
|
javax.swing.Icon |
loadIconByName(java.lang.String name)
This method loads an icon from a named resource.
|
void |
setDebug(boolean debug)
Sets the debug flag
|
static void |
setDefaultIconHandler(IconHandler defaultIconHandler)
Sets the default icon handler
|
void |
setResources(java.util.PropertyResourceBundle resources)
Sets the resource bundle
|
protected java.util.PropertyResourceBundle resources
protected static IconHandler defaultIconHandler
protected boolean debug
public IconHandler()
public IconHandler(java.util.PropertyResourceBundle resources)
resources
- Resource bundlepublic javax.swing.Icon loadIconById(java.lang.String id) throws java.io.IOException
id
- The icon indentifierjava.io.IOException
- Thrown by the resource loading codepublic javax.swing.Icon loadIconByName(java.lang.String name) throws java.io.IOException
name
- The resource namejava.io.IOException
- Thrown by the resource loading codepublic javax.swing.Icon getGrayIcon(javax.swing.Icon icon)
icon
- The icon to gray outpublic java.awt.Cursor buildCursorByName(java.lang.String name, java.awt.Point hotspot) throws java.io.IOException
name
- The resource name for the imagehotspot
- The cursor hotspotjava.io.IOException
- thrown by the loadImageByName callprotected boolean isDark(int rgb)
rgb
- The RGB value to testpublic static void setDefaultIconHandler(IconHandler defaultIconHandler)
iconHandler
- The new default icon handlerpublic static IconHandler getDefaultIconHandler()
public void setResources(java.util.PropertyResourceBundle resources)
resource
- The resource bundlepublic void setDebug(boolean debug)
resource
- The resource bundle