import java.awt.*;
//import java.applet.*;
import java.lang.*;  
import java.awt.event.*;


class RadarControls extends Panel implements ActionListener, ItemListener{
	Antenna ant;
	OutPanel outputpanel;
	SlidePanel slidepanel;
	Checkbox c1, c3, c2, c4;
	Button b1;
	Label lab1;
	
	private static final Color bgcolor = new Color(236,236,221);
	
	CheckboxGroup cgrid1, cgrid2;

	public RadarControls (Antenna ant){
		super();
		this.ant = ant;
		//setLayout(new GridLayout(2,2));
		setLayout(null);
		setBackground(bgcolor);
		setFont(new Font("Sanserif",Font.BOLD,12));
		lab1 = new Label("Plot:");
		setFont(new Font("Sanserif",Font.PLAIN,12));
		cgrid1=new CheckboxGroup();
		cgrid2=new CheckboxGroup();
		
		c1 = new Checkbox("E-H Fields",cgrid1,true);
		c3 = new Checkbox("Power",cgrid1,false);

		c1.addItemListener(this);
		c3.addItemListener(this);

		add(c1);
		add(c3);
		
		add(lab1);
		lab1.setBounds(5,7,40,15);
		lab1.setForeground(Color.blue);
		// CHANGE ======================================================
		//c1.setBounds(40,8,82,15);
		//c3.setBounds(130,8,65,15);
                c1.setBounds(35,6,92,20);
		c3.setBounds(125,6,75,20);
                //==============================================================
		c1.setBackground(bgcolor);
		c3.setBackground(bgcolor);
                
                b1=new Button("Instructions");
                b1.setBounds(205,6,85,20);
                b1.setBackground(Color.white);
                add(b1);
                Panel bb = new Panel();
                bb.setBackground(Color.black);
                add(bb);
                bb.setBounds(204,5,87,22);
                
                b1.addActionListener(this);
		
	}

	public void itemStateChanged(ItemEvent evt){
	    if(evt.getSource()==c1){
		ant.rcan1.repaint(1);
		ant.rcan2.repaint(1);
	    }	
	    else if(evt.getSource()==c3){
		ant.rcan1.repaint(3);
		ant.rcan2.repaint(3);
	    }
	}
	
	public void actionPerformed(ActionEvent evt){
            if(evt.getSource()==b1){
                //ant.about.setVisible(true);
                ant.instructions.setVisible(true);
                ant.instrFrame.setVisible(true);
                ant.cyanFrame.setVisible(true);
	    }	
	    
        }

}
