edu.rice.cs.util.swing
Class CenteredIcon

java.lang.Object
  extended by edu.rice.cs.util.swing.CenteredIcon
All Implemented Interfaces:
Icon

public class CenteredIcon
extends Object
implements Icon

This icon takes the given icon and centers it into a canvas of the given width and height. This is like a canvas resize for Icons. If the new size is smaller than the icon's size, then the edges of the given icon are clipped.


Constructor Summary
CenteredIcon(Icon base, int width, int height)
           
 
Method Summary
 Icon getBaseIcon()
           
 int getIconHeight()
           
 int getIconWidth()
           
 void paintIcon(Component c, Graphics g, int x, int y)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CenteredIcon

public CenteredIcon(Icon base,
                    int width,
                    int height)
Method Detail

getIconHeight

public int getIconHeight()
Specified by:
getIconHeight in interface Icon

getIconWidth

public int getIconWidth()
Specified by:
getIconWidth in interface Icon

paintIcon

public void paintIcon(Component c,
                      Graphics g,
                      int x,
                      int y)
Specified by:
paintIcon in interface Icon

getBaseIcon

public Icon getBaseIcon()