info.jonclark.gui
Class SwingResourceManager

java.lang.Object
  extended by info.jonclark.gui.SwingResourceManager

public class SwingResourceManager
extends Object

Utility class for managing resources such as colors, fonts, images, etc. This class may be freely distributed as part of any application or plugin.

Copyright (c) 2003 - 2004, Instantiations, Inc.
All Rights Reserved

Author:
scheglov_ke

Constructor Summary
SwingResourceManager()
           
 
Method Summary
static void clearImages(String section)
          Clear cached images in specified section
static ImageIcon getIcon(Class clazz, String path)
          Returns an icon stored in the file at the specified path relative to the specified class
static ImageIcon getIcon(Image image)
          Returns an icon based on the specified image
static ImageIcon getIcon(String path)
          Returns an icon stored in the file at the specified path
static ImageIcon getIcon(String section, String path)
          Returns an icon stored in the file at the specified path
static Image getImage(Class clazz, String path)
          Returns an image stored in the file at the specified path relative to the specified class
static Image getImage(String path)
          Returns an image stored in the file at the specified path
static Image getImage(String section, String path)
          Returns an image stored in the file at the specified path
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SwingResourceManager

public SwingResourceManager()
Method Detail

getImage

public static Image getImage(Class clazz,
                             String path)
Returns an image stored in the file at the specified path relative to the specified class

Parameters:
clazz - Class The class relative to which to find the image
path - String The path to the image file
Returns:
Image The image stored in the file at the specified path

getImage

public static Image getImage(String path)
Returns an image stored in the file at the specified path

Parameters:
path - String The path to the image file
Returns:
Image The image stored in the file at the specified path

getImage

public static Image getImage(String section,
                             String path)
Returns an image stored in the file at the specified path

Parameters:
section - String The storage section in the cache
path - String The path to the image file
Returns:
Image The image stored in the file at the specified path

clearImages

public static void clearImages(String section)
Clear cached images in specified section

Parameters:
section - the section do clear

getIcon

public static ImageIcon getIcon(Class clazz,
                                String path)
Returns an icon stored in the file at the specified path relative to the specified class

Parameters:
clazz - Class The class relative to which to find the icon
path - String The path to the icon file
Returns:
Icon The icon stored in the file at the specified path

getIcon

public static ImageIcon getIcon(String path)
Returns an icon stored in the file at the specified path

Parameters:
path - String The path to the icon file
Returns:
Icon The icon stored in the file at the specified path

getIcon

public static ImageIcon getIcon(String section,
                                String path)
Returns an icon stored in the file at the specified path

Parameters:
section - String The storage section in the cache
path - String The path to the icon file
Returns:
Icon The icon stored in the file at the specified path

getIcon

public static ImageIcon getIcon(Image image)
Returns an icon based on the specified image

Parameters:
image - Image The original image
Returns:
Icon The icon based on the image