net.sourceforge.pavlov.randommedia
Class ImageIconUtilities

java.lang.Object
  extended by net.sourceforge.pavlov.randommedia.ImageIconUtilities

public final class ImageIconUtilities
extends Object

Assorted utilities for ImageIcons.


Constructor Summary
ImageIconUtilities()
           
 
Method Summary
static ImageIcon formatImage(ImageIcon input, int size)
          Get an ImageIcon of the specified size from the given ImageIcon.
static Image formatImageOnly(ImageIcon input, int size)
          Poorly named method to get an Image of the desired size from the given ImageIcon.
static ImageIcon getNamedImageIcon(String myURL)
          Attempts to return the named URL as an ImageIcon.
static ImageIcon getNamedImageIcon(String myURL, int size)
          Attempts to return an ImageIcon of the specified size with the given URL.
static Dimension getScaledDimension(Image big, int size)
          Returns a width/height pair that maintains big's aspectRatio, with neither width or height larger than size.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageIconUtilities

public ImageIconUtilities()
Method Detail

formatImageOnly

public static Image formatImageOnly(ImageIcon input,
                                    int size)
Poorly named method to get an Image of the desired size from the given ImageIcon. Returns null for non-positive size.

Parameters:
input - an ImageIcon value
size - an int value
Returns:
an Image value

formatImage

public static ImageIcon formatImage(ImageIcon input,
                                    int size)
Get an ImageIcon of the specified size from the given ImageIcon. Returns null for non-positive size.

Parameters:
input - an ImageIcon value
size - an int value
Returns:
an ImageIcon value

getScaledDimension

public static Dimension getScaledDimension(Image big,
                                           int size)
Returns a width/height pair that maintains big's aspectRatio, with neither width or height larger than size. One of width or height will actually equal size.

Parameters:
big - an Image value
size - an int value
Returns:
a Dimension value

getNamedImageIcon

public static ImageIcon getNamedImageIcon(String myURL,
                                          int size)
Attempts to return an ImageIcon of the specified size with the given URL. Returns null on failure.

Parameters:
myURL - a String value
size - an int value
Returns:
an ImageIcon value

getNamedImageIcon

public static ImageIcon getNamedImageIcon(String myURL)
Attempts to return the named URL as an ImageIcon. null on failure.

Parameters:
myURL - a String value
Returns:
an ImageIcon value