Class ImageLibrary
- java.lang.Object
-
- gov.nasa.worldwindx.applications.worldwindow.core.ImageLibrary
-
public class ImageLibrary extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description ImageLibrary()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static javax.swing.ImageIcon
getIcon(java.lang.String iconName)
Retrun the icon associated with a specified name.static java.lang.String
getIconName(javax.swing.Icon icon)
Return the name associated with a specified icon.static java.awt.image.BufferedImage
getImage(java.lang.String imageName)
Retrun the image associated with a specified name.static java.awt.image.BufferedImage
getImageForIcon(javax.swing.Icon icon)
Returns the image associated with a specified icon.static java.lang.String
getImageName(java.awt.image.BufferedImage image)
Return the name associated with a specified image.static java.net.URL
getImageURL(java.lang.String imageName)
static javax.swing.Icon
getWarningIcon(int size)
Returns a warning icon, an icon that can be used when a desired icon is not available.static java.awt.image.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 java.lang.Object
register(java.lang.String name, java.lang.Object image)
Register an image with the library.static void
setInstance(ImageLibrary library)
Specify the instance for this conceptual singleton.
-
-
-
Method Detail
-
setInstance
public static void setInstance(ImageLibrary library)
Specify the instance for this conceptual singleton.- Parameters:
library
- the image library instance.
-
loadWarningImages
protected void loadWarningImages()
-
getWarningImage
public static java.awt.image.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.
-
getWarningIcon
public static javax.swing.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.
-
getImage
public static java.awt.image.BufferedImage getImage(java.lang.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.
-
getImageURL
public static java.net.URL getImageURL(java.lang.String imageName)
-
getIcon
public static javax.swing.ImageIcon getIcon(java.lang.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.
-
getImageForIcon
public static java.awt.image.BufferedImage getImageForIcon(javax.swing.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.
-
register
public static java.lang.Object register(java.lang.String name, java.lang.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.
-
getImageName
public static java.lang.String getImageName(java.awt.image.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.
-
getIconName
public static java.lang.String getIconName(javax.swing.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.
-
-