001         package com.croftsoft.core.animation.icon;
002    
003         import java.awt.Component;
004         import java.awt.Graphics;
005         import java.awt.Image;
006         import java.net.URL;
007         import javax.swing.ImageIcon;
008    
009         import com.croftsoft.core.lang.NullArgumentException;
010    
011         /*********************************************************************
012         * ImageIcon that stretches its painting across the entire Component.
013         *
014         * @version
015         *   2002-03-16
016         * @since
017         *   2002-02-17
018         * @author
019         *   <a href="https://www.croftsoft.com/">David Wallace Croft</a>
020         *********************************************************************/
021    
022         public final class  StretchImageIcon
023           extends ImageIcon
024         //////////////////////////////////////////////////////////////////////
025         //////////////////////////////////////////////////////////////////////
026         {
027    
028         public  StretchImageIcon ( Image  image )
029         //////////////////////////////////////////////////////////////////////
030         {
031           super ( image );
032         }
033    
034         public  StretchImageIcon ( URL  location )
035         //////////////////////////////////////////////////////////////////////
036         {
037           super ( location );
038         }
039    
040         public void  paintIcon (
041           Component  component,
042           Graphics   graphics,
043           int        x,
044           int        y )
045         //////////////////////////////////////////////////////////////////////
046         {
047           graphics.drawImage ( getImage ( ), 0, 0,
048             component.getWidth ( ), component.getHeight ( ), component );
049         }
050    
051         //////////////////////////////////////////////////////////////////////
052         //////////////////////////////////////////////////////////////////////
053         }