org.votech.ds6.imageutils
Class ImageHelper

java.lang.Object
  extended by org.votech.ds6.imageutils.ImageHelper

public class ImageHelper
extends java.lang.Object


Constructor Summary
ImageHelper(java.lang.Class base)
          Construct an ImageHelper.
 
Method Summary
 java.net.URL copyImageToTempFile(java.lang.String image, java.lang.String type)
          Copy an image from the classpath (relative to the base class) to a temporary file.
 void copyTo(java.lang.String location, java.io.File file, java.lang.String format)
          Copy an image that's on the classpath relative to the base class out to a given file
static void copyTo(java.net.URL original, java.io.File file, java.lang.String format)
          Copy an image out to a given file.
 ResizableImageIcon getIcon(java.lang.String name)
          Get a resizable icon with the given name, stored on the classpath relative to the supplied base class.
static ResizableImageIcon getIcon(java.net.URL url)
          Get a resizable Icon from the supplied URL.
 java.awt.Image getImage(java.lang.String name)
          Get an image with the given name, stored on the classpath relative to the supplied base class.
static java.awt.Image getImage(java.net.URL url)
          Get an image from the supplied URL
 java.net.URL getImageUrl(java.lang.String image)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageHelper

public ImageHelper(java.lang.Class base)
Construct an ImageHelper. All images will be located on the classpath relative to the supplied class.

Parameters:
base -
Method Detail

getIcon

public static ResizableImageIcon getIcon(java.net.URL url)
Get a resizable Icon from the supplied URL.

Parameters:
url -
Returns:

getImage

public static java.awt.Image getImage(java.net.URL url)
Get an image from the supplied URL

Parameters:
url -
Returns:

getIcon

public ResizableImageIcon getIcon(java.lang.String name)
Get a resizable icon with the given name, stored on the classpath relative to the supplied base class.

Parameters:
name -
Returns:

getImage

public java.awt.Image getImage(java.lang.String name)
Get an image with the given name, stored on the classpath relative to the supplied base class.


copyTo

public static void copyTo(java.net.URL original,
                          java.io.File file,
                          java.lang.String format)
                   throws java.io.IOException
Copy an image out to a given file.

Parameters:
original - original image
file - location to copy to
file - format
Throws:
java.io.IOException

copyTo

public void copyTo(java.lang.String location,
                   java.io.File file,
                   java.lang.String format)
            throws java.io.IOException
Copy an image that's on the classpath relative to the base class out to a given file

Parameters:
location - location of the file relative to the base class
file -
format -
Throws:
java.io.IOException

copyImageToTempFile

public java.net.URL copyImageToTempFile(java.lang.String image,
                                        java.lang.String type)
Copy an image from the classpath (relative to the base class) to a temporary file.

Parameters:
image - image name
type - jpg or gif etc
Returns:
a URL to the local file

getImageUrl

public java.net.URL getImageUrl(java.lang.String image)


Copyright © 2006 VOTech. All Rights Reserved.