edu.rice.cs.util.swing
Class CenteredIcon

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

public class CenteredIcon
extends java.lang.Object
implements javax.swing.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.


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

Field Detail

_base

private javax.swing.Icon _base

_w

private int _w

_h

private int _h
Constructor Detail

CenteredIcon

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

getIconHeight

public int getIconHeight()
Specified by:
getIconHeight in interface javax.swing.Icon

getIconWidth

public int getIconWidth()
Specified by:
getIconWidth in interface javax.swing.Icon

paintIcon

public void paintIcon(java.awt.Component c,
                      java.awt.Graphics g,
                      int x,
                      int y)
Specified by:
paintIcon in interface javax.swing.Icon

getBaseIcon

public javax.swing.Icon getBaseIcon()