import java.io.*;
import java.beans.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

public class vcrFinJFrame extends JFrame implements ActionListener
{

	vcrFinJPanel fjp, fjp1, fjp2, fjp3;
	JLabel fjt1,fjt2;
	JButton fjb1;

	car myCar;
	track myTrack;
	obstacle myObstacle;

	int result;

	int[] inputL;
	int[] inputR;
	int[] inputD;
	int[] inputU;
	
	public vcrFinJFrame (int inputResult, obstacle inputObstacle, track inputTrack, car inputCar, int[] inputInputL, int[] inputInputR, int[] inputInputD, int[] inputInputU)
	{
		super ("Game Over");

		result = inputResult;

		myObstacle = inputObstacle;
		myTrack = inputTrack;
		myCar = inputCar;
		
		inputL = inputInputL;
		inputR = inputInputR;
		inputD = inputInputD;
		inputU = inputInputU;


//------------------------------------------------------
// Create components: Jpanel, JLabel and JTextField
		if (result == 0)
		{
			fjt1 = new JLabel("Your car expoloded");
		}
		else
		{
			fjt1 = new JLabel("You Finished!");
		}

		JLabel fjt2 = new JLabel("Replay Finished.");	 		 

		fjp = new vcrFinJPanel();
    		fjp1 = new vcrFinJPanel();
	    	fjp2 = new vcrFinJPanel();
		fjp3 = new vcrFinJPanel();
    	  	
		fjb1 = new JButton("Close");
		//fjb2 = new JButton("Cancel");

//-----------------------------------------------------------------
//------------------------------------------------------
// Choose a Layout for JPanel and 
// add components to Jpanel according to layout 

		fjp.setLayout(new GridLayout(3,1,0,0));

   		fjp1.add(fjt1);
		fjp2.add(fjt2);	
		fjp3.add(fjb1);	
		//fjp3.add(fjb2);
		
		
		fjp.add(fjp1);
		fjp.add(fjp2);
		fjp.add(fjp3);
		
   		fjb1.addActionListener(this); 

//------------------------------------------------------
// Choose a Layout for JFrame and 
// add Jpanel to JFrame according to layout    	
		getContentPane().setLayout(new GridLayout());
		getContentPane().add(fjp,"Center");
//------------------------------------------------------
		setDefaultCloseOperation(EXIT_ON_CLOSE);
		setSize (300, 150);
		show();
	}
	
// actionPerformed
    

    public void actionPerformed(ActionEvent event)
	{
	
	
	 	Object obj = event.getSource();
	       	 
	     	if (obj == fjb1)
	    	{
			//SAVE
			
			this.dispose();

	     	}
	}

    
}
