/// Evolver Copyright 2000, Morgan McGuire
/// matrix@alum.mit.edu   http://graphics3d.com/matrix
import javax.swing.*;
import java.awt.*;
import java.net.*;

/**
 * A button whose entire look is specified by images.
 */
public class ImageButton extends JButton
{
  public ImageButton(String normalImageFile, String pressedImageFile)
  {
    super();
    Icon upIcon = null;
    Icon downIcon = null;

    try {
      upIcon = new ImageIcon(new URL(normalImageFile));
      downIcon = new ImageIcon(new URL(pressedImageFile));
    } catch (MalformedURLException e) {
      System.err.println("Warning: " + e);
    }
    
    setIcon(upIcon);
    setBorderPainted(false);
    setFocusPainted(false);
    setPressedIcon(downIcon);
    setMargin(new Insets(-4, -4, -4, -4));
  }
}
