net.clackrouter.jgraph.pad
Class ImageIconBean

java.lang.Object
  extended by javax.swing.ImageIcon
      extended by net.clackrouter.jgraph.pad.ImageIconBean
All Implemented Interfaces:
java.io.Serializable, javax.accessibility.Accessible, javax.swing.Icon

public class ImageIconBean
extends javax.swing.ImageIcon

This class transform a ImageIcon into a bean, allowing for encoding and decoding in XML using XMLEncoder and XMLDecoder.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.ImageIcon
javax.swing.ImageIcon.AccessibleImageIcon
 
Field Summary
 
Fields inherited from class javax.swing.ImageIcon
component, tracker
 
Constructor Summary
ImageIconBean()
          Creates an uninitialized image icon.
ImageIconBean(java.lang.String filename)
          Creates an image icon from the specified file.
ImageIconBean(java.lang.String filename, java.lang.String description)
          Creates an image icon from the specified file.
ImageIconBean(java.net.URL location)
          Creates an image icon from the specified URL.
ImageIconBean(java.net.URL location, java.lang.String description)
          Creates an image icon from the specified URL.
 
Method Summary
 java.lang.String getFileName()
          Returns the file name used to initialize the image.
 void setFileName(java.lang.String filename)
          Initializes this image icon from the specified file.
 
Methods inherited from class javax.swing.ImageIcon
getAccessibleContext, getDescription, getIconHeight, getIconWidth, getImage, getImageLoadStatus, getImageObserver, loadImage, paintIcon, setDescription, setImage, setImageObserver, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ImageIconBean

public ImageIconBean()
Creates an uninitialized image icon.


ImageIconBean

public ImageIconBean(java.lang.String filename)
Creates an image icon from the specified file. The image will be preloaded by using MediaTracker to monitor the loading answer of the image. The specified String can be a file name or a file path. When specifying a path, use the Internet-standard forward-slash ("/") as a separator. (The string is converted to an URL, so the forward-slash works on all systems.) For example, specify:
   new BeanifiedIcon("images/myImage.gif") 
 
The description is initialized to the filename string.

Parameters:
filename - A String specifying a filename or path.

ImageIconBean

public ImageIconBean(java.lang.String filename,
                     java.lang.String description)
Creates an image icon from the specified file. The image will be preloaded by using MediaTracker to monitor the loading answer of the image.

Parameters:
filename - The name of the file containing the image.
description - A brief textual description of the image.

ImageIconBean

public ImageIconBean(java.net.URL location)
Creates an image icon from the specified URL. The image will be preloaded by using MediaTracker to monitor the loaded answer of the image. The icon's description is initialized to be a string representation of the URL.

Parameters:
location - The URL for the image.

ImageIconBean

public ImageIconBean(java.net.URL location,
                     java.lang.String description)
Creates an image icon from the specified URL. The image will be preloaded by using MediaTracker to monitor the loaded answer of the image.

Parameters:
location - The URL for the image.
description - A brief textual description of the image.
Method Detail

getFileName

public java.lang.String getFileName()
Returns the file name used to initialize the image.


setFileName

public void setFileName(java.lang.String filename)
Initializes this image icon from the specified file. The image will be preloaded by using MediaTracker to monitor the loading answer of the image. The specified String can be a file name or a file path. When specifying a path, use the Internet-standard forward-slash ("/") as a separator. (The string is converted to an URL, so the forward-slash works on all systems.) For example, specify:
   new BeanifiedIcon().setFileName("images/myImage.gif") 
 

Parameters:
filename - A String specifying a filename or path.