/**
 * Starting Point Code for Image Processing Project
 * @author Richard Wicentowski and Tia Newhall (2005)
 * Modified by Kuzman Ganchev (kuzman@seas -- 2005).
 */
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class SimpleButton extends JButton implements ActionListener {
  static Font defaultFont = new Font("Dialog",Font.PLAIN,24);
  static Color defaultColor = Color.yellow;

  /** The ImageBase object that this button is associated with.
   * Needed in order to get and set the Picture object */
  ImageBase ib;

  /** manipulator associated with this button -- called when the
   * button is pressed */
  private Manipulator actor;
 
  /** this method is called when a button is pressed and calls the
   * Manipulator's manipulate method.  */
  public void actionPerformed (ActionEvent e) {
    actor.manipulate(ib);
  }

  /** creates a new SimpleButton with the text supplied by newActor.  
     */
  SimpleButton(ImageBase newIb, Manipulator newActor){
    ib = newIb;
    actor = newActor;
    setFont(defaultFont);
    setBackground(defaultColor);
    setText(newActor.getManipulationName());
    addActionListener(this);
  }
}
