All Packages Class Hierarchy This Package Previous Next Index
Class com.sun.java.swing.ImageIcon
java.lang.Object
|
+----com.sun.java.swing.ImageIcon
- public class ImageIcon
- extends Object
- implements Icon
An implementation of the Icon interface that paints Icons
from Images. Images that are created from a URL or filename
are preloaded using MediaTracker to monitor the loaded state
of the image.
All ImageIcons are cached, and can be retrieved using the
createImageIcon methods provided below. If the ImageIcon
is not in the cache, it is created and put in the cache
before being returned.
-
component
-
-
iconCache
-
-
tracker
-
-
ImageIcon(Image)
- Creates an ImageIcon from the image.
-
ImageIcon(Image, String)
- Creates an ImageIcon from the image.
-
ImageIcon(String)
- Creates an ImageIcon from the specified file.
-
ImageIcon(String, String)
- Creates an ImageIcon from the specified file.
-
ImageIcon(URL)
- Creates an ImageIcon from the specified URL.
-
ImageIcon(URL, String)
- Creates an ImageIcon from the specified URL.
-
createImageIcon(Image)
- Retrieves the ImageIcon corresponding to the given image
from the cache, else creates a new one.
-
createImageIcon(Image, String)
- Retrieves the ImageIcon corresponding to the given image
from the cache, else creates a new one.
-
createImageIcon(String)
- Retrieves the ImageIcon corresponding to the given filename
from the cache, else creates a new one.
-
createImageIcon(String, String)
- Retrieves the ImageIcon corresponding to the given filename
from the cache, else creates a new one.
-
createImageIcon(URL)
- Retrieves the ImageIcon corresponding to the given URL
from the cache, else creates a new one.
-
createImageIcon(URL, String)
- Retrieves the ImageIcon corresponding to the given URL
from the cache, else creates a new one.
-
getDescription()
- Get the description of the image.
-
getHeight()
- Get the height of the Icon
-
getImage()
- Returns the Icon's Image
-
getWidth()
- Get the width of the Icon
-
loadImage(Image)
- Wait for the image to load
-
paint(Graphics, int, int)
- Paints the Icon
-
setDescription(String)
- Set the description of the image.
component
protected static Component component
tracker
protected static MediaTracker tracker
iconCache
protected static Cache iconCache
ImageIcon
public ImageIcon(String filename,
String description)
- Creates an ImageIcon from the specified file. The image will
be preloaded by using MediaTracker to monitor the loading state
of the image.
- Parameters:
- filename - the name of the file containing the image
- description - a brief textual description of the image
ImageIcon
public ImageIcon(String filename)
- Creates an ImageIcon from the specified file. The image will
be preloaded by using MediaTracker to monitor the loading state
of the image.
ImageIcon
public ImageIcon(URL location,
String description)
- Creates an ImageIcon from the specified URL. The image will
be preloaded by using MediaTracker to monitor the loaded state
of the image.
- Parameters:
- URL - the URL for the image
- description - a brief textual description of the image
ImageIcon
public ImageIcon(URL location)
- Creates an ImageIcon from the specified URL. The image will
be preloaded by using MediaTracker to monitor the loaded state
of the image.
ImageIcon
public ImageIcon(Image image,
String description)
- Creates an ImageIcon from the image.
- Parameters:
- image - the image
- description - a brief textual description of the image
ImageIcon
public ImageIcon(Image image)
- Creates an ImageIcon from the image.
loadImage
protected void loadImage(Image image)
- Wait for the image to load
getImage
public Image getImage()
- Returns the Icon's Image
getDescription
public String getDescription()
- Get the description of the image. This is meant to be a brief
textual description of the object. For example, it might be
presented to a blind user to give an indication of the purpose
of the image.
setDescription
public void setDescription(String description)
- Set the description of the image. This is meant to be a brief
textual description of the object. For example, it might be
presented to a blind user to give an indication of the purpose
of the image.
paint
public synchronized void paint(Graphics g,
int x,
int y)
- Paints the Icon
getWidth
public int getWidth()
- Get the width of the Icon
getHeight
public int getHeight()
- Get the height of the Icon
createImageIcon
public static ImageIcon createImageIcon(Image image,
String description)
- Retrieves the ImageIcon corresponding to the given image
from the cache, else creates a new one.
- Parameters:
- image - the image
- description - a brief textual description of the image
createImageIcon
public static ImageIcon createImageIcon(Image image)
- Retrieves the ImageIcon corresponding to the given image
from the cache, else creates a new one.
createImageIcon
public static ImageIcon createImageIcon(URL location,
String description)
- Retrieves the ImageIcon corresponding to the given URL
from the cache, else creates a new one.
- Parameters:
- location - the URL for the image
- description - a brief textual description of the image
createImageIcon
public static ImageIcon createImageIcon(URL location)
- Retrieves the ImageIcon corresponding to the given URL
from the cache, else creates a new one.
createImageIcon
public static ImageIcon createImageIcon(String filename,
String description)
- Retrieves the ImageIcon corresponding to the given filename
from the cache, else creates a new one.
- Parameters:
- filename - the name of the file containing the image
- description - a brief textual description of the image
createImageIcon
public static ImageIcon createImageIcon(String filename)
- Retrieves the ImageIcon corresponding to the given filename
from the cache, else creates a new one.
All Packages Class Hierarchy This Package Previous Next Index