All Packages Class Hierarchy This Package Previous Next Index
Class java.awt.swing.ImageIcon
java.lang.Object
|
+----java.awt.swing.ImageIcon
- public class ImageIcon
- extends Object
- implements Icon, Serializable
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.
component-
tracker-
ImageIcon()
- Creates an uninitialized image icon.
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.
getDescription()
- Get the description of the image.
getIconHeight()
- Get the height of the Icon
getIconWidth()
- Get the width of the Icon
getImage()
- Returns the Icon's Image
getImageObserver()
- Return the umage observer for the image
loadImage(Image)
- Wait for the image to load
paintIcon(Component, Graphics, int, int)
- Paints the Icon
setDescription(String)
- Set the description of the image.
setImage(Image)
- Set the image displayed by this icon.
setImageObserver(ImageObserver)
- Set the image observer for the image.
component
protected static Component component
tracker
protected static MediaTracker tracker
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.
ImageIcon
public ImageIcon()
- Creates an uninitialized image icon.
loadImage
protected void loadImage(Image image)
- Wait for the image to load
getImage
public Image getImage()
- Returns the Icon's Image
setImage
public void setImage(Image image)
- Set the image displayed by this icon.
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.
paintIcon
public void paintIcon(Component c,
Graphics g,
int x,
int y)
- Paints the Icon
getIconWidth
public int getIconWidth()
- Get the width of the Icon
getIconHeight
public int getIconHeight()
- Get the height of the Icon
setImageObserver
public void setImageObserver(ImageObserver observer)
- Set the image observer for the image. Set this
property if the ImageIcon contains an animated GIF.
For example:
icon = new ImageIcon(...)
button.setImage(icon);
icon.setImageObserver(button);
getImageObserver
public ImageObserver getImageObserver()
- Return the umage observer for the image
All Packages Class Hierarchy This Package Previous Next Index
Submit a bug or feature