org.brains2b.swingext.gui
Class IconFactory

java.lang.Object
  extended by org.brains2b.swingext.gui.IconFactory

public final class IconFactory
extends java.lang.Object

Creates and caches Icons from the given Resource location

Version:
0.20 [Feb 20, 2007]
Author:
dennis@brains2b.nl

Field Summary
static int ICON_16
           
static int ICON_32
           
static int ICON_48
           
 
Method Summary
static javax.swing.ImageIcon createIcon(java.lang.String path)
          Create an ImageIcon from a path The icon is loaded from getClass().getResource(URL)
static javax.swing.ImageIcon createIcon(java.lang.String path, int type)
          Create an ImageIcon from a path with a specific size If the loaded ImageIcon is not the size defined the icon will be scaled with Image.SCALE_SMOOTH The icon is loaded from getClass().getResource(URL)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ICON_16

public static final int ICON_16
See Also:
Constant Field Values

ICON_32

public static final int ICON_32
See Also:
Constant Field Values

ICON_48

public static final int ICON_48
See Also:
Constant Field Values
Method Detail

createIcon

public static final javax.swing.ImageIcon createIcon(java.lang.String path)
Create an ImageIcon from a path

The icon is loaded from getClass().getResource(URL)

Parameters:
path - String, the path
Returns:
ImageIcon, null if the Icon could not be loaded

createIcon

public static final javax.swing.ImageIcon createIcon(java.lang.String path,
                                                     int type)
Create an ImageIcon from a path with a specific size

If the loaded ImageIcon is not the size defined the icon will be scaled with Image.SCALE_SMOOTH

The icon is loaded from getClass().getResource(URL)

Parameters:
path - String, the path
int, - the size of the Icon. You can use one of the defaults ICON_16|ICON_32|ICON_48, but any value will work.
Returns:
ImageIcon, null if the Icon could not be loaded