//Name: TO DO: Fill this comment in
//Date: TO DO: Fill this comment in
//Purpose: TO DO: Fill this comment in
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
public class CardGame_Eclipse extends JPanel implements ActionListener
{
    //For screens
    Panel p_card;
    Panel card1, card2, card3, card4;
    CardLayout cdLayout = new CardLayout ();

    //Settings Screen
    JTextField entername1, entername2, entername3, entername4;

    //Game Screen
    JLabel picture;
    JTextField guess;
    JLabel output, score;
    JButton nextCard, done, giveUp;
    /*
    Card current = new Card ();
    Deck cardDeck = new Deck ();
    int right = 0;
    int total = 0;
    */

    //Formatting
    Color backgroundColour = new Color (255, 255, 255);
    Color buttonColour = new Color (200, 200, 200);
    Color buttonText = new Color (0, 0, 0);
    Color titleColour = Color.black;
    Font titleFont = new Font ("Arial", Font.PLAIN, 30);
    Font promptFont = new Font ("Arial", Font.PLAIN, 20);

    public CardGame_Eclipse ()
    {
	p_card = new Panel ();
	p_card.setLayout (cdLayout);
	//TO DO: Bring back in when you are ready to work on other screens
	opening ();
	instructions ();
	settings ();
	gameScreen ();
     
	setLayout (new BorderLayout ());
	add ("Center", p_card);

	//set up the Card Deck so it is ready to begin
	//cardDeck.shuffle ();
    }


    public void opening ()
    { //TO DO: Fill this comment in
	card1 = new Panel ();
	card1.setBackground (backgroundColour);

	JButton next = new JButton ("Click Anywhere to Enter Animal Guessing Game");
	next.setPreferredSize (new Dimension (350, 530));
	next.setActionCommand ("2");
	next.addActionListener (this);
	next.setBorder (null);
	next.setBackground (backgroundColour);
	next.setForeground (buttonText);

	card1.add (next);
	p_card.add ("1", card1);
    }


    public void instructions ()
    { //TO DO: Fill this comment in
	card2 = new Panel ();
	card2.setBackground (backgroundColour);
	JLabel title = new JLabel ("The Instructions");
	title.setFont (titleFont);
	title.setForeground (titleColour);
	Panel p = new Panel ();
	JButton settings = new JButton ("Settings");
	settings.setActionCommand ("3");
	settings.addActionListener (this);
	settings.setPreferredSize (new Dimension (150, 50));
	settings.setBackground (buttonColour);
	settings.setForeground (buttonText);
	JButton gameScreen = new JButton ("Game");
	gameScreen.setActionCommand ("4");
	gameScreen.addActionListener (this);
	gameScreen.setPreferredSize (new Dimension (150, 50));
	gameScreen.setBackground (buttonColour);
	gameScreen.setForeground (buttonText);

	card2.add (title);
	p.add (settings);
	p.add (gameScreen);
	card2.add (p);
	p_card.add ("2", card2);
    }


    public void settings ()
    { //TO DO: Fill this comment in
	card3 = new Panel ();
	card3.setBackground (backgroundColour);
	JLabel title = new JLabel ("Enter Player Names:");
	title.setFont (titleFont);
	title.setForeground (titleColour);
	Panel p = new Panel ();
	JLabel namePmt = new JLabel ("Player 1 name:");
	namePmt.setFont (promptFont);
	entername1 = new JTextField (10);
	entername1.setFont (promptFont);

	Panel p2 = new Panel ();
	JLabel namePmt2 = new JLabel ("Player 2 name:");
	namePmt2.setFont (promptFont);
	entername2 = new JTextField (10);
	entername2.setFont (promptFont);

	Panel p3 = new Panel ();
	JLabel namePmt3 = new JLabel ("Player 3 name:");
	namePmt3.setFont (promptFont);
	entername3 = new JTextField (10);
	entername3.setFont (promptFont);

	Panel p4 = new Panel ();
	JLabel namePmt4 = new JLabel ("Player 4 name:");
	namePmt4.setFont (promptFont);
	entername4 = new JTextField (10);
	entername4.setFont (promptFont);

	JButton entrance = new JButton ("To the game");
	entrance.setActionCommand ("4");
	entrance.addActionListener (this);
	entrance.setPreferredSize (new Dimension (300, 50));
	entrance.setBackground (buttonColour);
	entrance.setForeground (buttonText);

	card3.add (title);
	p.add (namePmt);
	p.add (entername1);

	p2.add (namePmt2);
	p2.add (entername2);

	p3.add (namePmt3);
	p3.add (entername3);

	p4.add (namePmt4);
	p4.add (entername4);

	card3.add (p);
	card3.add (p2);
	card3.add (p3);
	card3.add (p4);
	card3.add (entrance);
	p_card.add ("3", card3);
    }


    public void gameScreen ()
    { //TO DO: Fill this comment in
	card4 = new Panel ();
	card4.setBackground (backgroundColour);
	JLabel title = new JLabel ("Animal Guessing Game");
	title.setFont (titleFont);
	title.setForeground (titleColour);
	picture = new JLabel (createImageIcon ("blank.png"));
	JLabel pmt = new JLabel ("Guess:");
	pmt.setFont (new Font ("Arial", Font.PLAIN, 20));
	guess = new JTextField (8);
	guess.setFont (new Font ("Arial", Font.PLAIN, 20));
	done = new JButton ("Guess");
	done.addActionListener (this);
	done.setActionCommand ("guess");
	//done.setEnabled (false);
	done.setBackground (buttonColour);
	done.setForeground (buttonText);
	giveUp = new JButton ("Give Up");
	giveUp.addActionListener (this);
	giveUp.setActionCommand ("giveUp");
	//giveUp.setEnabled (false);
	giveUp.setBackground (buttonColour);
	giveUp.setForeground (buttonText);


	output = new JLabel ("First, press new card to begin.");
	output.setFont (new Font ("Arial", Font.PLAIN, 20));
	score = new JLabel ("You have 000 out of 000 correct.");
	score.setFont (new Font ("Arial", Font.PLAIN, 20));

	JButton shuffle = new JButton ("Shuffle");
	shuffle.addActionListener (this);
	shuffle.setActionCommand ("shuffle");
	shuffle.setPreferredSize (new Dimension (110, 30));
	shuffle.setBackground (buttonColour);
	shuffle.setForeground (buttonText);
	nextCard = new JButton ("Next Card");
	nextCard.addActionListener (this);
	nextCard.setActionCommand ("nextCard");
	nextCard.setPreferredSize (new Dimension (110, 30));
	nextCard.setBackground (buttonColour);
	nextCard.setForeground (buttonText);
	JButton getHint = new JButton ("Hint");
	getHint.addActionListener (this);
	getHint.setActionCommand ("getHint");
	getHint.setPreferredSize (new Dimension (110, 30));
	getHint.setBackground (buttonColour);
	getHint.setForeground (buttonText);
	JButton winner = new JButton ("Evaluate Win");
	winner.addActionListener (this);
	winner.setActionCommand ("win");
	winner.setPreferredSize (new Dimension (110, 30));
	winner.setBackground (buttonColour);
	winner.setForeground (buttonText);
	JButton instruct = new JButton ("Instructions");
	instruct.addActionListener (this);
	instruct.setActionCommand ("2");
	instruct.setPreferredSize (new Dimension (110, 30));
	instruct.setBackground (buttonColour);
	instruct.setForeground (buttonText);
	JButton settings = new JButton ("Settings");
	settings.addActionListener (this);
	settings.setActionCommand ("3");
	settings.setPreferredSize (new Dimension (110, 30));
	settings.setBackground (buttonColour);
	settings.setForeground (buttonText);

	card4.add (title);
	card4.add (picture);
	card4.add (output);
	Panel guessLine = new Panel ();
	guessLine.add (pmt);
	guessLine.add (guess);
	Panel pickoption = new Panel (new GridLayout (2, 1));
	pickoption.add (done);
	pickoption.add (giveUp);
	guessLine.add (pickoption);
	card4.add (guessLine);

	card4.add (score);
	Panel buttonLine = new Panel (new GridLayout (2, 3));

	buttonLine.add (nextCard);
	buttonLine.add (getHint);
	buttonLine.add (shuffle);
	buttonLine.add (winner);
	buttonLine.add (instruct);
	buttonLine.add (settings);
	card4.add (buttonLine);

	p_card.add ("4", card4);
    }


    public void actionPerformed (ActionEvent e)
    {

	//TO DO: Fill this comment in
	if (e.getActionCommand ().equals ("1"))
	    cdLayout.show (p_card, "1");
	else if (e.getActionCommand ().equals ("2"))
	    cdLayout.show (p_card, "2");
	else if (e.getActionCommand ().equals ("3"))
	    cdLayout.show (p_card, "3");
	else if (e.getActionCommand ().equals ("4"))
	    cdLayout.show (p_card, "4");

	//TO DO: Fill this comment in
	else if (e.getActionCommand ().equals ("nextCard"))
	{

	}
	else if (e.getActionCommand ().equals ("getHint"))
	{

	}
	else if (e.getActionCommand ().equals ("guess"))
	{
	}
	else if (e.getActionCommand ().equals ("shuffle"))
	{

	}
	else if (e.getActionCommand ().equals ("win"))
	{

	}
	else if (e.getActionCommand ().equals ("giveup"))
	{

	}

    }


    protected static ImageIcon createImageIcon (String path)
    {
	java.net.URL imgURL = CardGame_Eclipse.class.getResource (path);
	if (imgURL != null)
	    return new ImageIcon (imgURL);
	else
	    return null;
    }
    
    
    public static void main (String[] args)
    {
	JFrame.setDefaultLookAndFeelDecorated (true);
	//Create and set up the window.
	JFrame frame = new JFrame ("Card Game App");
	frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
	//Create and set up the content pane.
	JComponent newContentPane = new CardGame_Eclipse ();
	newContentPane.setOpaque (true);
	frame.setContentPane (newContentPane);
	frame.setSize (350, 530);
	frame.setVisible (true);
       
    }
}
