/*Based entriely on @(#)ConcentrationApplet.java 1.0  15 November 2004 */

import edu.neu.ccs.gui.*;

import java.awt.*;
import java.net.*;
import javax.swing.*;

/** Creates the Java Applet*/
public class BlackJackApplet 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) {
            System.err.println("createGUI failed");
        }
    }

    /* The action to create the button for the applet GUI. */
    private SimpleAction newGame =
        new SimpleAction("New BlackJack Game") {
        	public void perform() {
        	    new BlackJack();
        	}
    	};
    
    /*
     * 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);
    }
}