/* @(#)ConcentrationApplet.java 1.0  March 1 2005 */

import edu.neu.ccs.gui.*;

import java.awt.*;
import java.net.*;
import javax.swing.*;

public class ConcentrationApplet extends JApplet
{
    
    public void init() {
        //Execute a job on the event-dispatching thread:
        //creating this applet's GUI.
        try {
            javax.swing.SwingUtilities.invokeAndWait(
                new Runnable() {
	                public void run() {
	                    setImagesURL();
	                    createGUI();
	                }
                });
        } catch (Exception e) {
        }
    }

    /* The action to create the button for the applet GUI. */
    private SimpleAction newGame =
        new SimpleAction("New Concentration Game") {
        	public void perform() {
        	    ConcentrationGame.newGame();
        	}
    	};
    
    /*
     * The method to create the applet GUI with one button
     * that in turn launches the new game panel.
     */
    private void createGUI() {
        Container pane = getContentPane();
        pane.setLayout(new CenterLayout());
        pane.add(new JButton(newGame));
    }
    
    /*
     * The method to set the URL for the game images from the
     * APPLET PARAM tag with name "imagesURL".
     */
    private void setImagesURL() {
        String url = getParameter("imagesURL");
        
        if ((url != null) && (url.length() > 0))
            Images.setImagesURL(url);
    }
}