package ola.jsame;

import java.awt.event.ActionEvent;
import javax.swing.*;

/**
 * Same game GUI
 * <P>
 * 
 * @author Owen Astrachan
 */
public class SameGameGui extends JFrame
{
    private static final int OUR_WIDTH  = 50;
    
    /**
     * @param model is the model for this view
     */
    public SameGameGui(SameGameModel model)
    {
	setTitle("OOGA SameGame");
	JPanel panel = new SameGameCore(model);
        makeMenu();
        
	setContentPane(panel);
	setDefaultCloseOperation(EXIT_ON_CLOSE);
	pack();
	setSize(OUR_WIDTH*model.getCols(), OUR_WIDTH*model.getRows());
	setVisible(true);
    }
    
    private void makeMenu()
    {
	JMenu menu = new JMenu("File");
	
	menu.add(new AbstractAction("Quit")
	    {
		public void actionPerformed(ActionEvent e) {
		    System.exit(0);
		}
	    });
	JMenuBar menubar = new JMenuBar();
	menubar.add(menu);
	setJMenuBar(menubar);	
    }

    public static void main(String args[])
    {
	SameGameModel model = new SameGameModel(6,15);
	SameGameGui gui = new SameGameGui(model);
    }

}
