com.quadrique.jbuildingblocks.gui
Class Resources

java.lang.Object
  extended by com.quadrique.jbuildingblocks.gui.Resources

public class Resources
extends Object

This class is used to manipulate the resources (e.g. configuration file, icon file, locale-specific objects...) of an application. The underlying implementation uses the application ClassLoader to retrieve the resources.

Author:
Hervé Rivere

Constructor Summary
Resources()
           
 
Method Summary
 void addResoucePath(String zPath)
           
 ImageIcon getIcon(String zIconName)
          This method builds an ImageIcon instance from the given image file name.
static Resources getInstance()
          This method returns the unique Resources class instance.
 URL getResource(String zResourceName)
          This method builds an URL that points to a given resource (e.g an XSLT stylesheet file, a look and feel theme file, a configuration file...).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Resources

public Resources()
Method Detail

getInstance

public static final Resources getInstance()
This method returns the unique Resources class instance. If there has been already one instantiation, the same instance is returned so that it can be shared accross the application. A typical usage would be: Resources.getInstance().xxxxXxx(); or Resources lResources = Resources.getInstance(); lResources.xxxxXxx();

Returns:
the unique Resources instance

addResoucePath

public void addResoucePath(String zPath)
                    throws Exception
Parameters:
zPath -
Throws:
Exception

getIcon

public ImageIcon getIcon(String zIconName)
This method builds an ImageIcon instance from the given image file name.

Parameters:
zIconName - the name of the file (e.g. "resources/images/FileOpen.gif" if the file "FileOpen.gif" is stored in the "resources/images" folder of the application jar archive). The file has to be either a .gif or a .jpg file.
Returns:
the newly created ImageIcon or null if theimage could not be found

getResource

public URL getResource(String zResourceName)
This method builds an URL that points to a given resource (e.g an XSLT stylesheet file, a look and feel theme file, a configuration file...).

Parameters:
zResourceName - the name of the resource (e.g. "Transformation.xsl" if the file "Transformation.xsl" is stored in the "com/.../resources/file" path has been added to this instance or the full path).
Returns:
a URL for reading the resource, or null if the resource could not be found or the caller doesn't have adequate privileges to get the resource


Copyright © 2001-2009 Quadrique Corporation. All Rights Reserved.