NASA World Wind

gov.nasa.worldwindx.applications.worldwindow.core
Class ImageLibrary

java.lang.Object
  extended by gov.nasa.worldwindx.applications.worldwindow.core.ImageLibrary

public class ImageLibrary
extends Object


Constructor Summary
ImageLibrary()
           
 
Method Summary
static ImageIcon getIcon(String iconName)
          Retrun the icon associated with a specified name.
static String getIconName(Icon icon)
          Return the name associated with a specified icon.
static BufferedImage getImage(String imageName)
          Retrun the image associated with a specified name.
static BufferedImage getImageForIcon(Icon icon)
          Returns the image associated with a specified icon.
static String getImageName(BufferedImage image)
          Return the name associated with a specified image.
static URL getImageURL(String imageName)
           
static Icon getWarningIcon(int size)
          Returns a warning icon, an icon that can be used when a desired icon is not available.
static BufferedImage getWarningImage(int size)
          Returns a warning image, an image that can be used when a desired image is not available.
protected  void loadWarningImages()
           
static Object register(String name, Object image)
          Register an image with the library.
static void setInstance(ImageLibrary library)
          Specify the instance for this conceptual singleton.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageLibrary

public ImageLibrary()
Method Detail

getIcon

public static ImageIcon getIcon(String iconName)
Retrun the icon associated with a specified name. If the library does not contain an icon of the specified name, it is first searched for in the application's classpath, and if not found retrieved from this instance's image server.

Parameters:
iconName - the name of the desired icon.
Returns:
the icon if it's available, otherwise null.

getIconName

public static String getIconName(Icon icon)
Return the name associated with a specified icon.

Parameters:
icon - the icon whose name to return.
Returns:
the icon name, or null if the icon is not registered with this instance.

getImage

public static BufferedImage getImage(String imageName)
Retrun the image associated with a specified name. If the library does not contain an image of the specified name, it is first searched for in the application's classpath, and if not found retrieved from this instance's image server.

Parameters:
imageName - the name of the desired image.
Returns:
the image if it's available, otherwise null.

getImageForIcon

public static BufferedImage getImageForIcon(Icon icon)
Returns the image associated with a specified icon.

Parameters:
icon - the icon whose image is desired.
Returns:
the image associated with the icon, or null if the icon is not available.

getImageName

public static String getImageName(BufferedImage image)
Return the name associated with a specified image.

Parameters:
image - the image whose name to return.
Returns:
the image name, or null if the image is not registered with this instance.

getImageURL

public static URL getImageURL(String imageName)

getWarningIcon

public static Icon getWarningIcon(int size)
Returns a warning icon, an icon that can be used when a desired icon is not available.

Parameters:
size - the desired icon size in pixels, either 16, 24, 32 or 64.
Returns:
a warning icon of the requested size, or one of size 64 if a size larger than 64 is requested.

getWarningImage

public static BufferedImage getWarningImage(int size)
Returns a warning image, an image that can be used when a desired image is not available.

Parameters:
size - the desired image size in pixels, either 16, 24, 32 or 64.
Returns:
a warning image of the requested size, or one of size 64 if a size larger than 64 is requested.

loadWarningImages

protected void loadWarningImages()

register

public static Object register(String name,
                              Object image)
Register an image with the library.

Parameters:
name - the image name. If null the image is not registered.
image - the image. If null the image is not registered.
Returns:
the reference to the image passed in the image argument.

setInstance

public static void setInstance(ImageLibrary library)
Specify the instance for this conceptual singleton.

Parameters:
library - the image library instance.

NASA World Wind