org.geotoolkit.gui.swing
Class IconFactory

Object
  extended by IconFactory

@ThreadSafe
public final class IconFactory
extends Object

A factory for Icons. 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 mostly for icons from the Java look and feel Graphics Repository.

Since:
2.3
Version:
3.00
Author:
Martin Desruisseaux (IRD)
Module:
display/geotk-widgets-swing (download)    View source code for this class

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.
 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 icon.

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.
Returns:
A button with the specified image icon.


Copyright © 2009-2013 Geotoolkit.org. All Rights Reserved.