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

public class titleJFrameA extends JFrame implements ActionListener
{
    int i = -100;
    JButton jb1, jb2, jb3;
    
    titleJPanelA tjp;


	track myTrack = new track();
	obstacle myObstacle = new obstacle(myTrack.trackType);
	car myCar = new car();


    public titleJFrameA ()
    {
	super ("Title");
//------------------------------------------------------
// Create components: JPanel, JButton
    	tjp = new titleJPanelA();
        
        jb1 = new JButton("New Simulation");
        jb2 = new JButton("Load Simulation");
        jb3 = new JButton("About...");

	//THIS is the set bounds
	jb1.setBounds(125, 500, 150, 30);
	jb2.setBounds(325, 500, 150, 30);
	jb3.setBounds(525, 500, 150, 30);


// add buttons to JPanel		
//-------------------------------------------------------	    
	//THIS sets the output to null
	tjp.setLayout(null);
        
        tjp.add(jb1);
        tjp.add(jb2);
        tjp.add(jb3);
//----------------------------------------------------------------
        jb1.addActionListener(this);
	jb2.addActionListener(this);
	jb3.addActionListener(this);
//------------------------------------------------------
	getContentPane().add(tjp);
	setDefaultCloseOperation(EXIT_ON_CLOSE);
	setSize (800, 600);
	show();

}

//-------------------------------------------------------------------
// actionPerformed
// All the events generated by the user interaction with components are captured here.
    public void actionPerformed(ActionEvent event) 
    {
       	 Object obj = event.getSource();
       	 
	if (obj == jb1)
    	{
     		//System.out.println("the choice was "+event.getActionCommand());
		new simJFrame(myObstacle, myTrack, myCar);
		this.dispose();
     	}
	if (obj == jb2)
    	{
     		System.out.println("the choice was "+event.getActionCommand());
		new vcrJFrame(myObstacle, myTrack, myCar);
		this.dispose();
     	}
	if (obj == jb3)
    	{
     	 	//System.out.println("the choice was "+event.getActionCommand());
		new aboutJFrame();
		this.dispose();
     	}
	
    }
}
