import java.awt.*;
import java.awt.image.*;
import java.applet.*;

public class FilterButton1 extends Applet
{
 Image  image;
 Image  img;
 boolean b;
 ImageFilter filter;
 String imagename;
	        
public void init()
{
 imagename = getParameter("imagename");       
 image = getImage(getDocumentBase(), imagename);
 img = image;
	       	
}

public boolean mouseMove(Event e, int x, int y)
{       
 b = false;
 color();
 repaint();
 return true;
}

public boolean mouseExit(Event e, int x, int y)
{       
 b = true;
 color();
 repaint();
 return true;
}

public void paint(Graphics g)
{ g.drawImage(img,0,0,this); }

public void update(Graphics g)
{ paint(g); }
   
public void color()
{       
 if (b == true) img = image;
	 
 else
     { 
      filter= new ColorFilter();
      ImageProducer ip = image.getSource();
      ip = new FilteredImageSource(ip, filter);
      img = createImage(ip); 
     }
}
}

class ColorFilter extends RGBImageFilter
{       public int filterRGB(int x, int y, int rgb)
        {       return  ((rgb & 0xff00ffff) | ((rgb & 0xff) << 16));
        }
}



