JAPI 0.9.0
Yet another Java API
API Documentation

net.sf.japi.swing
Class IconManager

java.lang.Object
  extended by net.sf.japi.swing.IconManager

public final class IconManager
extends Object

Class to handle icons. Default size is 16. Instances must have an associated ClassLoader, otherwise several methods will not work properly but throw a NullPointerException instead. So if you do not provide a ClassLoader, be sure the class you provide has one, or if you use the no-arg constructor resp. the default instance, be sure the IconManager class itself was loaded with some ClassLoader other than null.

Author:
Christian Hujer
Todo:
this class should be refactored into a more generic version and accessible through ActionFactory?, it should be possible to initialize the paths through properties

Constructor Summary
IconManager()
          Create a IconManager.
IconManager(Class<?> clazz)
          Create an IconManager.
IconManager(ClassLoader cl)
          Create an IconManager.
 
Method Summary
 int[] getAvailableSizes()
          Return the available sizes for icons.
static IconManager getDefaultIconManager()
          Get the default IconManager.
 Icon getIcon(String s)
          Load an icon.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IconManager

public IconManager()
Create a IconManager. Uses the IconManager's class loader. Only use this if you want to be independent of the global icon size settings. The recommended way to get a default IconManager instance is {#getDefaultIconManager()}.


IconManager

public IconManager(Class<?> clazz)
Create an IconManager.

Parameters:
clazz - Class to get ClassLoader for IconManager

IconManager

public IconManager(ClassLoader cl)
Create an IconManager.

Parameters:
cl - ClassLoader to create IconManager for
Method Detail

getDefaultIconManager

public static IconManager getDefaultIconManager()
Get the default IconManager. The ClassLoader in use is the classloader IconManager was loaded with, whatever classloader that was.

Returns:
default IconManaager

getAvailableSizes

public int[] getAvailableSizes()
Return the available sizes for icons.

Returns:
available icon sizes

getIcon

@Nullable
public Icon getIcon(String s)
Load an icon.

Parameters:
s - icon name, like "general/About" or "navigation/Forward"
Returns:
Icon for s

JAPI
Yet another Java API
API Documentation

© 2005-2006 Christian Hujer. All rights reserved. See copyright