swingx
Version 2005-08-19

org.jdesktop.swingx.painter
Class IconPainter

java.lang.Object
  extended by org.jdesktop.swingx.JavaBean
      extended by org.jdesktop.swingx.painter.AbstractPainter
          extended by org.jdesktop.swingx.painter.ImagePainter
              extended by org.jdesktop.swingx.painter.IconPainter
All Implemented Interfaces:
Painter

public class IconPainter
extends ImagePainter

An ImagePainter subclass that provides convenience methods "setIcon" and "getIcon" to use Icons (and ImageIcons) rather than Images directly. Because this class uses "Icon" and because there is a "getImage" method from the parent class, sometimes an intermediate BufferedImage will be created to generate the image to return. This should be fairly performant, but will of course have some overhead. To avoid this overhead, use an ImageIcon where possible.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.jdesktop.swingx.painter.ImagePainter
ImagePainter.Style
 
Constructor Summary
IconPainter()
          Create a new IconPainter
IconPainter(Icon icon)
          Create a new IconPainter with the specified icon.
 
Method Summary
 Icon getIcon()
           
 Image getImage()
           
 void setIcon(Icon icon)
          Set the icon to use.
 
Methods inherited from class org.jdesktop.swingx.painter.ImagePainter
getImagePosition, getStyle, paintBackground, setImage, setImagePosition, setImageScale, setStyle
 
Methods inherited from class org.jdesktop.swingx.painter.AbstractPainter
getAlphaInterpolation, getAntialiasing, getClip, getColorRendering, getComposite, getDithering, getEffects, getFractionalMetrics, getInterpolation, getRendering, getRenderingHint, getRenderingHints, getResizeClip, getStrokeControl, getTextAntialiasing, isUseCache, paint, restoreState, saveState, setAlphaInterpolation, setAntialiasing, setClip, setColorRendering, setComposite, setDithering, setEffects, setEffects, setFractionalMetrics, setInterpolation, setRendering, setRenderingHint, setRenderingHints, setResizeClip, setStrokeControl, setTextAntialiasing, setUseCache
 
Methods inherited from class org.jdesktop.swingx.JavaBean
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, hasListeners, removePropertyChangeListener, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IconPainter

public IconPainter()
Create a new IconPainter


IconPainter

public IconPainter(Icon icon)
Create a new IconPainter with the specified icon.

Parameters:
icon - the icon to be painted
Method Detail

setIcon

public void setIcon(Icon icon)
Set the icon to use. This will fire property change notification not only for the "icon" property, but also for the "image" property.

Parameters:
icon - the Icon to use

getIcon

public Icon getIcon()
Returns:
the Icon used by this painter

getImage

public Image getImage()
Overrides:
getImage in class ImagePainter
Returns:
the image used for painting the background of this panel

swingx
Version 2005-08-19