import java.awt.Dimension;
import java.awt.FlowLayout;

import javax.swing.JButton;
import javax.swing.JFrame;

/**
 * A frame that contains a button that pauses/resumes the animated view
 * of the model and a panel that displays the animated view.
 * 
 * @author David Mutchler.
 *         Created October 17, 2008.
 */
public class AnimationFrame extends JFrame {
	
	/**
	 * Constructs and initializes the frame,
	 * including a button that pauses/resumes the animated view of the model.
	 * 
	 * @param controller Controller that responds to the pause/resume button
	 * @param view View that displays the current state of the model (animation)
	 */
	public AnimationFrame(Controller controller, View view) {
		this.setSize(new Dimension(400, 400));
		this.setLayout(new FlowLayout());
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		JButton pauseButton = new JButton("Press me to pause the animation");
		pauseButton.addActionListener(controller);
		
		this.add(pauseButton);
		this.add(view);
	}
}