org.tbee.swing
Class ResizingImageIcon

java.lang.Object
  extended by javax.swing.ImageIcon
      extended by org.tbee.swing.ResizingImageIcon
All Implemented Interfaces:
Serializable, Cloneable, Accessible, Icon

public class ResizingImageIcon
extends ImageIcon
implements Cloneable

This class can hold multiple bitmaps and selects the best fitting one (largest-smaller-than-required). If ScaleToFit is true, this image is scaled to best fit (maintaining the aspect ratio). Use ImageIO.read to read sources like file and inputstream Use IcoUtils.getListOfImages to read all images of an Icon file into a resizing icon.

Version:
$Revision: 1.18 $
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.ImageIcon
ImageIcon.AccessibleImageIcon
 
Field Summary
static String SOURCECODE_VERSION
          Standard variable for determining version of a class file.
 
Fields inherited from class javax.swing.ImageIcon
component, tracker
 
Constructor Summary
ResizingImageIcon()
           
ResizingImageIcon(Image image)
           
 
Method Summary
 void addImage(Image image)
           
 void addImages(List list)
           
 Object clone()
          get a copy
 ResizingImageIcon cloneBrighter()
          get a copy
 ResizingImageIcon cloneIdentical()
          get a copy
 Image getImage()
          get the image
 boolean getScaleToFit()
           
 void paintIcon(Component c, Graphics g, int x, int y)
          paint using the best matching icon
 void removeImage(Image image)
           
 void setImage(Image value)
           
 void setScaleToFit(boolean value)
           
 
Methods inherited from class javax.swing.ImageIcon
getAccessibleContext, getDescription, getIconHeight, getIconWidth, getImageLoadStatus, getImageObserver, loadImage, setDescription, setImageObserver, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SOURCECODE_VERSION

public static final String SOURCECODE_VERSION
Standard variable for determining version of a class file.

See Also:
Constant Field Values
Constructor Detail

ResizingImageIcon

public ResizingImageIcon()

ResizingImageIcon

public ResizingImageIcon(Image image)
Parameters:
image -
Method Detail

addImage

public void addImage(Image image)

removeImage

public void removeImage(Image image)

addImages

public void addImages(List list)

getScaleToFit

public boolean getScaleToFit()

setScaleToFit

public void setScaleToFit(boolean value)

getImage

public Image getImage()
get the image

Overrides:
getImage in class ImageIcon

setImage

public void setImage(Image value)
Overrides:
setImage in class ImageIcon

paintIcon

public void paintIcon(Component c,
                      Graphics g,
                      int x,
                      int y)
paint using the best matching icon

Specified by:
paintIcon in interface Icon
Overrides:
paintIcon in class ImageIcon

clone

public Object clone()
get a copy

Overrides:
clone in class Object

cloneIdentical

public ResizingImageIcon cloneIdentical()
get a copy


cloneBrighter

public ResizingImageIcon cloneBrighter()
get a copy



Copyright © 2011 KnowledgePlaza. All Rights Reserved.