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

public class ForcePanel extends Panel{
        PlaneWave_State state;
        
	protected static final Color bgcolor = new Color(246,246,246);
	protected TextField text1[];
	protected Label lab1[], lab2[];
	public Label titlelabel;
	public Button b1;
        public Scrollbar slider1;
        public Checkbox c1, c2, c3, c4, c5;
        public CheckboxGroup cgrid;
        
        public int SCROLLMIN=750, SCROLLMAX=1001;
        public int SCROLLMIN2=0, SCROLLMAX2=20001;
        public int SCROLLMIN3=0, SCROLLMAX3=2001;
        
        private int SleepTime = 50;
        
	protected String titulo="Unknown Title";
	protected static final Font labfont=new Font("SanSerif",Font.PLAIN,12);
	protected static final Font titlefont=new Font("SanSerif",Font.BOLD,16);
        
	public ForcePanel(PlaneWave_State state){
		super();
		setLayout(null);
                this.state = state;
                
		setBackground(bgcolor);
                
                cgrid = new CheckboxGroup();
                c1=new Checkbox("0.1 m",cgrid,true);
                c2=new Checkbox("1 m",cgrid,false);
                c3=new Checkbox("10 m",cgrid,false);
                c4=new Checkbox("100 m",cgrid,false);
                c5=new Checkbox("1 km",cgrid,false);
                
                add(c1);
		c1.setFont(new Font("SanSerif",Font.PLAIN,12));
		c1.setBackground(bgcolor);
		c1.setForeground(Color.magenta.darker());
		//c1.setBounds(300,20,60,20);
                c1.setBounds(360,20,80,20);
                c1.setVisible(true);
                
                add(c2);
		c2.setFont(new Font("SanSerif",Font.PLAIN,12));
		c2.setBackground(bgcolor);
		c2.setForeground(Color.magenta.darker());
                //c2.setBounds(360,20,60,20);
                c2.setBounds(440,20,60,20);
                c2.setVisible(true);
                
                add(c3);
		c3.setFont(new Font("SanSerif",Font.PLAIN,12));
		c3.setBackground(bgcolor);
		c3.setForeground(Color.magenta.darker());
		//c3.setBounds(420,20,60,20);
                c3.setBounds(500,20,80,20);
                c3.setVisible(true);
                
                //add(c4);
		c4.setFont(new Font("SanSerif",Font.PLAIN,12));
		c4.setBackground(bgcolor);
		c4.setForeground(Color.magenta.darker());
                //c4.setBounds(480,20,60,20);
                c4.setVisible(true);
                
                //add(c5);
		c5.setFont(new Font("SanSerif",Font.PLAIN,12));
		c5.setBackground(bgcolor);
		c5.setForeground(Color.magenta.darker());
		//c5.setBounds(540,20,60,20);
                c5.setVisible(true);
             
                // Animation speed slider
                slider1 = new Scrollbar(Scrollbar.HORIZONTAL,SCROLLMAX-1-SleepTime,1,SCROLLMIN,SCROLLMAX);
                slider1.setBounds(12,398,150,15);
                add(slider1);
                Panel p1 = new Panel();
                    p1.setBackground(Color.black);
                    add(p1);
                    p1.setBounds(11,397,152,17);
                
	}
	
	public void paint(Graphics g){
            
            Graphics2D g2d = (Graphics2D)g;
            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
            
	    g.clearRect(0,0,getSize().width-2,getSize().height);
	                
            g.setColor(Color.black);
            
            g.setColor(Color.black);
            g.drawLine(302,8,425,8);
            g.drawLine(465,8,590,8);
            MaestroG.drawArrowtip(307,8,8,g);
            MaestroG.drawArrowtip(588,8,7,g);
            g.setColor(Color.black);
            
            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
            MaestroG.subscripter("W","","",g,12,440,13);
            
            g.setColor(Color.red);
            MaestroG.drawLineThick(g,10.0,10.0,60.0,10.0,2,Color.red);
            MaestroG.drawLineThick(g,60.0,10.0,48.0,14.0,2,Color.red);
            MaestroG.drawLineThick(g,60.0,10.0,48.0,6.0,2,Color.red);
            
            MaestroG.drawLineThick(g,10.0,30.0,60.0,30.0,2,Color.blue);
            MaestroG.drawLineThick(g,60.0,30.0,48.0,34.0,2,Color.blue);
            MaestroG.drawLineThick(g,60.0,30.0,48.0,26.0,2,Color.blue);
            
            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
            
            g.setColor(Color.red);
            MaestroG.subscripter("Electric Force","","",g,12,70,15);
            g.setColor(Color.blue);
            MaestroG.subscripter("Magnetic Force","","",g,12,70,35);
            
            g.setColor(Color.magenta.darker());
            //MaestroG.subscripter("W  = ","","",g,12,265,33);
            MaestroG.subscripter("W  = ","","",g,12,325,33);
            //------------------------------------------------------------------
        }
}

