org.geotools.gui.swing
Class IconFactory

Object
  extended by IconFactory

public final class IconFactory
extends Object

A factory for Icon. This class caches some of the created icons. This factory should be used only for small icons, since they may be cached for the JVM lifetime. This class is used especially for Java look and feel Graphics Repository. This class is thread safe.

Since:
2.3
Author:
Martin Desruisseaux
Module:

Field Summary
static IconFactory DEFAULT
          The default factory instance.
 
Method Summary
 JButton getButton(String path, String description, String fallback)
          Returns a button with the specified image.
 Icon getIcon(String path)
          Returns the icon for the specified name, or null if none.
 Icon getIcon(String path, String description)
          Returns an icon for the specified name and description, or null if none.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT

public static final IconFactory DEFAULT
The default factory instance.

Method Detail

getIcon

public Icon getIcon(String path)
Returns the icon for the specified name, or null if none. If this method has already been invoked for the specified path, then the previously created icon is returned.

Parameters:
path - The icon path, relative to the application classpath.
Returns:
The icon, or null if no image was found for the specified path.

getIcon

public Icon getIcon(String path,
                    String description)
Returns an icon for the specified name and description, or null if none.

Parameters:
path - The icon path, relative to the application classpath.
description - brief textual description of the image, or null if none.
Returns:
The icon, or null if no image was found for the specified path.

getButton

public JButton getButton(String path,
                         String description,
                         String fallback)
Returns a button with the specified image.

Parameters:
path - The icon path, relative to the application classpath.
description - brief textual description of the image, or null if none.
fallback - A text to put in the button if the image were not found.


Copyright © 1996-2009 Geotools. All Rights Reserved.