//ObliqueInputPanel.java
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.lang.*;
//import maestro.lib.graphics.*;
//import maestro.lib.math.*;

public class ObliqueInputPanel extends Panel implements AdjustmentListener, ActionListener, ItemListener{
    private static final Color bgcolor = new Color(236,236,236);
    //private static final Color bgcolor = new Color(170,240,240);

    // See if drawing the "in" and "out" circles into images works for LINUX
    private Image im1, im2;
    private Graphics buf1, buf2;

    private static final Font labfont0=new Font("SanSerif",Font.PLAIN,11);
    private static final Font labfont=new Font("SanSerif",Font.PLAIN,12);
    private static final Font labfontbig=new Font("SanSerif",Font.PLAIN,14);
    private static final Font labfontbigI=new Font("Serif",Font.ITALIC,14);
    private static final Font titlefont=new Font("SanSerif",Font.BOLD,12);
    private static final int SCROLLMIN = 0;
    private static final int SCROLLMAX = 9001;
    Label titlelabel;	
    Label lab1, lab2, lab3, lab3b, lab4, lab5, lab6, lab7, lab8, lab9, lab10,
          labm1, labm2, labpa, labpb, labpc, labpd, labpe, labpf, 
          labr1, labr2, labr3, labr4, labHz, labSm,
          labeqa, labeqb, labeqc, labeqd, labeqe, labeqf, labclick;
    Label vlab1;
    TextField text1, text2, text3, text4, text5, text6, text7;
    Button b1;
    public Label labscale;
    public Panel scale1, scale2;
    
    public Checkbox c1, c2, c3, c4, c5, c6, c7, c8, c9;
    public CheckboxGroup cgrp, cgrp2, cgrp3, cgfield;
    public Scrollbar slider, slider2, slider_scale;
    private Oblique_State state;
    public TitleCanvas title;
    public ObliqueInputPanel(Oblique_State state){
	super();
	this.state = state;
	setBackground(bgcolor);
	setLayout(null);
	titlelabel = new Label("Input",Label.CENTER);
	titlelabel.setFont(titlefont);
	
	title = new TitleCanvas();
	    add(title);
	    title.setBounds(1,1,75,25);
	
        
	labclick = new Label("Click Update",Label.RIGHT);
	labclick.setFont(titlefont);
	labclick.setForeground(Color.red);
        labclick.setVisible(false);
            
	labm1 = new Label("Medium 1",Label.RIGHT);
	labm1.setFont(labfont);
	labm1.setForeground(Color.red.darker());
        
        labm2 = new Label("Medium 2",Label.RIGHT);
	labm2.setFont(labfont);
	labm2.setForeground(Color.blue.darker());
        
	lab1 = new Label("\u03b5",Label.RIGHT);
	lab1.setFont(labfontbig);
	
	lab2 = new Label("\u03bc",Label.RIGHT);
	lab2.setFont(labfontbig);
        
        labr1 = new Label("r",Label.LEFT);
	labr1.setFont(labfont);
        labr2 = new Label("r",Label.LEFT);
	labr2.setFont(labfont);
        labr3 = new Label("r",Label.LEFT);
	labr3.setFont(labfont);
        labr4 = new Label("r",Label.LEFT);
	labr4.setFont(labfont);
        
        labeqa = new Label("=",Label.RIGHT);
	labeqa.setFont(labfontbig);
	labeqb = new Label("=",Label.RIGHT);
	labeqb.setFont(labfontbig);
        labeqc = new Label("=",Label.RIGHT);
	labeqc.setFont(labfontbig);
        labeqd = new Label("=",Label.RIGHT);
	labeqd.setFont(labfontbig);
	labeqe = new Label("=",Label.RIGHT);
	labeqe.setFont(labfontbig);
        labeqf = new Label("=",Label.RIGHT);
	labeqf.setFont(labfontbig);
        labHz = new Label("Hz",Label.LEFT);
	labHz.setFont(labfontbig);
        
        labSm = new Label("S/m",Label.LEFT);
	labSm.setFont(labfont0);
        
	lab3 = new Label("Incident  Transverse Field",Label.CENTER);
	lab3.setFont(labfont);
	
        lab3b = new Label("Component",Label.CENTER);
	lab3b.setFont(labfont);
        
        labpa = new Label("|\u0393| , |\u03c4|",Label.CENTER);
	labpa.setFont(labfont);
        labpb = new Label("|t|",Label.CENTER);
	labpb.setFont(labfont);
        
        labpc = new Label("\u0393 , \u03c4",Label.CENTER);
	labpc.setFont(labfont);
        labpd = new Label("t",Label.CENTER);
	labpd.setFont(labfont);
        
        labpe = new Label("R , T",Label.CENTER);
	labpe.setFont(labfont);
        labpf = new Label("T",Label.CENTER);
	labpf.setFont(labfont);
        
	labscale = new Label("plot-zoom",Label.RIGHT);
	labscale.setFont(labfont0);
        
        
        text1 = new TextField("1.0");// epsilon_r
	text1.setFont(labfont);
	
	text2 = new TextField("1.0");// mu_r
	text2.setFont(labfont);
	
	text3 = new TextField("0.0");// sigma
	text3.setFont(labfont);
	
	lab4 = new Label("\u03b5",Label.RIGHT);
	lab4.setFont(labfontbig);
	
	lab5 = new Label("\u03bc",Label.RIGHT);
	lab5.setFont(labfontbig);
	
	lab6 = new Label("\u03c3",Label.RIGHT);
	lab6.setFont(labfontbig);
	
        lab10 = new Label("Field:",Label.RIGHT);
	lab10.setFont(labfont);
	
        text4 = new TextField("2.55"); // epsilon_r
	text4.setFont(labfont);
	
	text5 = new TextField("1.0"); // mu_r
	text5.setFont(labfont);
	
	text6 = new TextField("1.0"); // sigma
	text6.setFont(labfont);
	
	lab7 = new Label("f",Label.RIGHT);
	lab7.setFont(labfont);
	
	text7 = new TextField("1.0E9");
	text7.setFont(labfont);
	
	b1 = new Button("Update");
	
	cgrp = new CheckboxGroup();
	c1 = new Checkbox("//",cgrp,true);
	c1.setFont(labfont);
	c2 = new Checkbox("\u22a5",cgrp,false);
	c2.setFont(labfont);
	
        cgrp2 = new CheckboxGroup();
        c3 = new Checkbox("In",cgrp2,true);
	c3.setFont(labfont);
	c4 = new Checkbox("Out",cgrp2,false);
	c4.setFont(labfont);
	
        cgrp3 = new CheckboxGroup();
	c5 = new Checkbox("plot",cgrp3,true);
	c5.setFont(labfont);
	c6 = new Checkbox("plot",cgrp3,false);
	c6.setFont(labfont);
	c7 = new Checkbox("plot",cgrp3,false);
	c7.setFont(labfont);
        
        cgfield = new CheckboxGroup();
	c8 = new Checkbox("Electric",cgfield,true);
	c8.setFont(labfont);
	c9 = new Checkbox("Magnetic",cgfield,false);
	c9.setFont(labfont);
        
	lab8 = new Label("Angle of Incidence: ",Label.LEFT);
	lab8.setFont(labfont);
	
	lab9 = new Label("Polarization: ",Label.LEFT);
	lab9.setFont(labfont);
	
	slider = new Scrollbar(Scrollbar.HORIZONTAL,450,1,SCROLLMIN,901);
	slider2 = new Scrollbar(Scrollbar.HORIZONTAL,0,1,SCROLLMIN,1000);
        slider_scale = new Scrollbar(Scrollbar.HORIZONTAL,5,1,1,50);
        slider.setBackground(Color.white);
        slider2.setBackground(Color.white);
        //slider_scale.setBackground(Color.white);
        slider_scale.setBackground(bgcolor);     // not invisible in UNIX
        
	vlab1 = new Label("45 \u00ba",Label.LEFT);
	
	//add(titlelabel);
        add(labclick);
	add(labm1);
        add(labm2);
        add(lab1);
	add(text1);
	add(lab2);
	add(text2);
	add(lab3);
        add(lab3b);
        add(labr1); add(labr2); add(labr3); add(labr4);
        add(labeqa); add(labeqb); add(labeqc); add(labeqd); add(labeqe); add(labeqf);
        add(labHz); add(labSm);
        add(labpa); add(labpb); add(labpc); add(labpd); add(labpe); add(labpf);
        
	//add(text3);
	add(lab4);
	add(text4);
	add(lab5);
	add(text5);
	add(lab10);
        add(lab6);
	add(text6);
	add(lab7);
	add(text7);
	add(b1);
	add(c1);
	add(c2);
        add(c3);
        add(c4);
        add(c5);
        add(c6);
        add(c7);
        add(c8);
        add(c9);
	add(lab8);
	add(lab9);
	add(slider);
        add(slider2);
        add(slider_scale);
	add(vlab1);
	
	titlelabel.setBounds(5,25,150,25); 
	
	//lab7.setBounds(10,33,175,20);   
	text7.setBounds(55,35,75,20);
	//lab1.setBounds(10,58,175,20);   
	//text1.setBounds(195,58,75,20);
	//lab2.setBounds(10,80,175,20);   
	//text2.setBounds(195,80,75,20);
	
        //labclick.setBounds(185,5,80,25);
        lab7.setBounds(10,35,20,20);
        lab7.setFont(labfontbigI);
        //labeqe.setBounds(40,35,10,20);   8/2/14
        labeqe.setBounds(35,35,15,20);

        labHz.setBounds(132,35,25,20);
        lab7.setForeground(Color.black);
        labeqe.setForeground(Color.black);
        labHz.setForeground(Color.black);
        
	
        //lab1.setBounds(10,81,20,20);     8/2/14
        //labr1.setBounds(30,86,10,20);
        //labeqa.setBounds(40,81,10,20);
        lab1.setBounds(7,81,20,20);
        labr1.setBounds(27,86,10,20);
        labeqa.setBounds(37,81,15,20);


        lab1.setForeground(Color.red.darker());
        labr1.setForeground(Color.red.darker());
        labeqa.setForeground(Color.red.darker());
        text1.setBounds(55,80,75,19);
        
        text1.setForeground(Color.red.darker());
	//lab2.setBounds(10,100,20,20);     8/2/14
        //labr2.setBounds(30,105,10,20);
        //labeqb.setBounds(40,100,10,20);
	lab2.setBounds(7,100,20,20);
        labr2.setBounds(27,105,10,20);
        labeqb.setBounds(37,100,15,20);

        lab2.setForeground(Color.red.darker());
        labr2.setForeground(Color.red.darker());
        labeqb.setForeground(Color.red.darker());
        text2.setBounds(55,101,75,19);
        text2.setForeground(Color.red.darker());
        
        //labm1.setBounds(55,122,65,14);   //  8/2/14
        //labm2.setBounds(195,122,65,14);
        labm1.setBounds(50,122,65,14);
        labm2.setBounds(190,122,65,14);
        
        Panel line1 = new Panel();
	    line1.setBackground(Color.black);
	    add(line1);
	    line1.setBounds(15,139,270,1);
        
        //lab4.setBounds(150,79,20,20);    //  8/2/14
        //labr3.setBounds(170,84,10,20);
        //labeqc.setBounds(180,79,10,20);
        lab4.setBounds(145,79,20,20);
        labr3.setBounds(165,84,10,20);
        labeqc.setBounds(175,79,15,20);

        labSm.setBounds(270,61,24,20);
        labSm.setForeground(Color.blue.darker());
        
        lab4.setForeground(Color.blue.darker());
        labr3.setForeground(Color.blue.darker());
        labeqc.setForeground(Color.blue.darker());
        text4.setBounds(195,80,75,19); //epsilon_r medium 2
	text4.setForeground(Color.blue.darker());
        
        //lab5.setBounds(150,100,20,20);    //  8/2/14
        //labr4.setBounds(170,105,10,20);
        //labeqd.setBounds(180,100,10,20);
        lab5.setBounds(145,100,20,20);
        labr4.setBounds(165,105,10,20);
        labeqd.setBounds(175,100,15,20);

	lab5.setForeground(Color.blue.darker());
        labr4.setForeground(Color.blue.darker());
        labeqd.setForeground(Color.blue.darker());
        text5.setBounds(195,101,75,19); // mu_r medium 2
        text5.setForeground(Color.blue.darker());
	//text3.setBounds(195,146,75,20);
	
	//labeqf.setBounds(180,58,10,20);
	labeqf.setBounds(175,58,15,20);
        labeqf.setForeground(Color.blue.darker());
        //lab6.setBounds(155,58,20,20);
        lab6.setBounds(150,58,20,20);
        lab6.setForeground(Color.blue.darker());
	text6.setBounds(195,59,75,19);
        
	
	b1.setBounds(195,33,75,20);
        b1.setBackground(new Color(250,250,250));
        
        Panel sliderb1 = new Panel();
	    sliderb1.setBackground(Color.cyan);
	    add(sliderb1);
	    sliderb1.setBounds(193,32,78,22);
	    
	Panel sliderb2 = new Panel();
	    sliderb2.setBackground(Color.black);
	    add(sliderb2);
	    sliderb2.setBounds(192,31,80,24);
	
        //c1.setBounds(70,155,40,20);    8/2/14
        //c2.setBounds(30,155,35,20);
        //c1.setBounds(65,155,45,20);    9/17/14
        //c2.setBounds(25,155,40,20);
        c1.setBounds(65,155,50,20);
        c2.setBounds(15,155,50,20);
	c1.setBackground(bgcolor);
	c2.setBackground(bgcolor);
	
        //c3.setBounds(145,155,35,20);    8/2/14
	//c4.setBounds(215,155,45,20);
        //c3.setBounds(140,155,40,20);    9/17/14
	//c4.setBounds(210,155,50,20);
        c3.setBounds(140,155,42,20);
	c4.setBounds(210,155,52,20);
	c3.setBackground(bgcolor);
	c4.setBackground(bgcolor);
	lab3.setBounds(125,140,160,15);
        
	Panel line2 = new Panel();
	    line2.setBackground(Color.black);
	    add(line2);
	    line2.setBounds(15,177,270,1);
        
        //c8.setBounds(110,180,70,20);    8/2/14
        c8.setBounds(110,180,80,20); 
	c8.setBackground(bgcolor);
        c8.setForeground(Color.magenta.darker());
        //c9.setBounds(210,180,75,20);    8/2/14
        c9.setBounds(210,180,83,20);
	c9.setBackground(bgcolor);
        c9.setForeground(Color.blue);
        
        lab10.setBounds(45, 182, 50, 15);
        
        
        //c5.setBounds(110,200,60,20);    8/2/14   subtract 15
        //c5.setBounds(95,200,50,20);     9/17/14
        c5.setBounds(95,200,65,20);
	c5.setBackground(bgcolor);
        //c6.setBounds(210,200,60,20);    8/2/14    subtract 10
        //c6.setBounds(200,200,50,20);    9/17/14
        c6.setBounds(200,200,65,20);
	c6.setBackground(bgcolor);
        //c7.setBounds(30,200,60,20);    8/2/14   subtract 20
        //c7.setBounds(10,200,50,20);    9/17/14
        c7.setBounds(10,200,65,20);
	c7.setBackground(bgcolor);
        
        
        //labpa.setBounds(150,202,50,15);   8/3/14 
        labpa.setBounds(145,202,50,15);
        //labpb.setBounds(85,180,20,15);
        
        //labpc.setBounds(250,202,30,15);    8/3/14
        labpc.setBounds(252,202,30,15); 
        //labpd.setBounds(175,180,20,15);
        
        //labpe.setBounds(70,202,30,15);    8/3/14 
        labpe.setBounds(62,202,30,15); 
        //labpf.setBounds(265,180,20,15);
        
        Panel line3 = new Panel();
	    line3.setBackground(Color.black);
	    add(line3);
	    line3.setBounds(15,221,270,1);
        
	lab8.setBounds(50,223,120,15);
	//lab9.setBounds(25,140,70,15);
	lab9.setBounds(25,140,75,15);
	slider.setBounds(20,244,260,15);
        slider2.setBounds(20,265,260,15);
        
        slider_scale.setBounds(195,10,75,15);
	scale2 = new Panel();
	    scale2.setBackground(Color.cyan);
	    add(scale2);
	    scale2.setBounds(194,9,77,17);
	scale1 = new Panel();
	    scale1.setBackground(Color.black);
	    add(scale1);
	    scale1.setBounds(193,8,79,19);
	add(scale2); add(scale1);  
        scale1.setVisible(false);
        scale2.setVisible(false);
        labscale.setVisible(false);
        slider_scale.setVisible(false);
        
        labscale.setBounds(120,8,70,15);
        add(labscale);
        
        vlab1.setBounds(180,223,80,15);
	
	Panel slider2a = new Panel();
	    slider2a.setBackground(Color.cyan);
	    add(slider2a);
	    slider2a.setBounds(19,243,262,17);
	    
	Panel slider1 = new Panel();
	    slider1.setBackground(Color.black);
	    add(slider1);
	    slider1.setBounds(18,242,264,19);
	
        Panel slider4 = new Panel();
	    slider4.setBackground(Color.cyan);
	    add(slider4);
	    slider4.setBounds(19,264,262,17);
	    
	Panel slider3 = new Panel();
	    slider3.setBackground(Color.black);
	    add(slider3);
	    slider3.setBounds(18,263,264,19);
	    
        
	//Listeners 
	slider.addAdjustmentListener(this);	
        slider2.addAdjustmentListener(this);
        slider_scale.addAdjustmentListener(this);
        
        b1.addActionListener(this);
	c1.addItemListener(this);
	c2.addItemListener(this);
        c3.addItemListener(this);
        c4.addItemListener(this);
   }
   
    public void adjustmentValueChanged(AdjustmentEvent evt){
	if(evt.getSource()==slider){
            //labclick.setVisible(true);
	    if(slider.getValue()==900){
		state.theta1 = Math.PI/2;
		vlab1.setText("90.0 \u00ba ");
		slider.setValue(900);
                slider2.setValue(0);
                slider2.setEnabled(false);
                //state.ignition();
            }
	    else{
		//state.theta1 = slider.getValue()*Math.PI/1800.0;
		//vlab1.setText(""+slider.getValue()/10.0+" \u00ba ");
                state.theta1 = MaestroA.rounder(Math.PI/180.0*(slider.getValue()/10.0+MaestroA.rounder(slider2.getValue()*0.0001,4)),6);
                vlab1.setText(""+(MaestroA.rounder(slider.getValue()/10.0+MaestroA.rounder(slider2.getValue()*0.0001,4),6))+" \u00ba ");
                slider2.setEnabled(true);
                //slider2.setValue(0);
                //state.ignition();
            }
	}
        if(evt.getSource()==slider2){
                //labclick.setVisible(true);
		state.theta1 = MaestroA.rounder(Math.PI/180.0*(slider.getValue()/10.0+MaestroA.rounder(slider2.getValue()*0.0001,4)),6);
                vlab1.setText(""+(MaestroA.rounder(slider.getValue()/10.0+MaestroA.rounder(slider2.getValue()*0.0001,4),6))+" \u00ba ");
                //state.ignition();
	}
	//state.ignition();
    }

    
    public void actionPerformed(ActionEvent evt){
		if(evt.getSource() == b1){
                  labclick.setVisible(false);
                  if(Double.valueOf(text1.getText()).doubleValue() < 1.0){
                     text1.setText("1.0");
                  }
                  
                  if(Double.valueOf(text2.getText()).doubleValue() < 1.0){
                     text2.setText("1.0");
                  }
                  
                  if(Double.valueOf(text4.getText()).doubleValue() < 1.0){
                     text4.setText("1.0");
                  }
                  
                  if(Double.valueOf(text5.getText()).doubleValue() < 1.0){
                     text5.setText("1.0");
                  }
                  
                  if(Double.valueOf(text6.getText()).doubleValue() < 1.0e-6){
                     text6.setText("1.0e-6");
                  }
                   
                  if(Double.valueOf(text7.getText()).doubleValue() > 1.0e22){
                     text7.setText("1.0e22");
                  }
                  
                  if(Double.valueOf(text7.getText()).doubleValue() < 1.0){
                     text7.setText("1.0");
                  }
                  
		  state.epsilon_r1=Double.valueOf(text1.getText()).doubleValue();
		  state.mu_r1=Double.valueOf(text2.getText()).doubleValue();
		  state.conductivity1=Double.valueOf(text3.getText()).doubleValue();
		  state.epsilon_r2=Double.valueOf(text4.getText()).doubleValue();
		  state.mu_r2=Double.valueOf(text5.getText()).doubleValue();
		  state.conductivity2=Double.valueOf(text6.getText()).doubleValue();
		  state.frequency=Double.valueOf(text7.getText()).doubleValue();
		}
		state.ignition();
		state.scan_coefficients();
    }
    
    public void itemStateChanged(ItemEvent evt){
	if(evt.getSource() == c1){
	    state.isPolarizationParallel=true;
	    state.ignition();
	    state.scan_coefficients();
	}
	else if(evt.getSource() == c2){
	    state.isPolarizationParallel=false;
	    state.ignition();
	    state.scan_coefficients();
	}
    }



    public void paint(Graphics g){
        if(im1 == null){
            im1 = createImage(14,14);
            buf1 = im1.getGraphics();
            drawIn(buf1);
            im2 = createImage(14,14);
            buf2 = im2.getGraphics();
            drawOut(buf2);
        } else {  // they are not always the same color ...
            drawIn(buf1);
            drawOut(buf2);
        }
            
	g.setColor(Color.black);
	g.draw3DRect(0,0,getSize().width-1,getSize().height-1,true);
        int xpos = 270 - 7;
        int ypos2 = 165 - 7;
        int xpos2 = 190 - 7;
        int ypos = 165 - 7;

        g.drawImage(im1,xpos2,ypos2,null);
        g.drawImage(im2,xpos,ypos,null);
    }


    private void drawIn(Graphics g) {
        double radiusH = 6;
        Color colore;
        if(state.isPolarizationParallel){colore = Color.blue;}
        else{colore = Color.magenta.darker();}
              
        MaestroG.fillCircleThick(g, 7,7, radiusH, 2, Color.white);
        MaestroG.drawLineThick(g, 4,4, 10,10, 1, colore);
        MaestroG.drawLineThick(g, 10,4, 4,10, 1,colore);           
        MaestroG.drawCircleThick(g, 7,7, radiusH, 2, colore);        
    }


    private void drawOut(Graphics g) {
        double radiusH = 6;
        Color colore;
        if(state.isPolarizationParallel){colore = Color.blue;}
        else{colore = Color.magenta.darker();}
        
        MaestroG.fillCircleThick(g, 7,7, radiusH, 2, Color.white);
        MaestroG.drawCircleThick(g, 7,7, 1.0,2, colore);
        MaestroG.drawCircleThick(g, 7,7, radiusH, 2, colore);        
    }

	
    public void OLDpaint(Graphics g){
	g.setColor(Color.black);
	g.draw3DRect(0,0,getSize().width-1,getSize().height-1,true);
        
        g.setColor(Color.gray);
            //g.drawLine(15,137,getSize().width-15,137);
            //g.drawLine(15,177,getSize().width-15,177);
            //g.drawLine(15,220,getSize().width-15,220);
        
        double radiusH = 6;
        double xpos = 270;
        double ypos2 = 165.0;
        double xpos2 = 190.0;
        double ypos = 165.0;
            
            Color colore;
            if(state.isPolarizationParallel){colore = Color.blue;}
            else{colore = Color.magenta.darker();}
            
            MaestroG.fillCircleThick(g, xpos, ypos, radiusH, 2, Color.white);
                                    
            MaestroG.drawCircleThick(g, xpos, ypos, 1.0,2, colore);
            MaestroG.drawCircleThick(g, xpos, ypos, radiusH, 2, colore);
            
            MaestroG.fillCircleThick(g, xpos2, ypos2, radiusH, 2, Color.white);
            MaestroG.drawLineThick(g, xpos2-(double)(radiusH/2), ypos2-(double)(radiusH/2),
                                    xpos2 + (double)(radiusH/2), ypos2 + (double)(radiusH/2), 1, colore);
            MaestroG.drawLineThick(g, xpos2+(double)(radiusH/2),
                                    ypos2-(double)(radiusH/2),
                                    xpos2 - (double)(radiusH/2),
                                    ypos2 + (double)(radiusH/2), 1,colore);           
            MaestroG.drawCircleThick(g, xpos2, ypos2, radiusH, 2, colore);
            
           
            
    }

}


class TitleCanvas extends Canvas{
	
	private static final Font normalfont = new Font("Sanserif",Font.PLAIN,12);
	private static final Font subfont    = new Font("Sanserif",Font.PLAIN,10);
	private static final Font titlefont  =new Font("Sanserif",Font.BOLD,16);
	
	public TitleCanvas(){
	    super();
	}
	
	public void paint(Graphics g){
	    int x, y, dx, dxx, dy, dyy;
	    Complex temp1, temp2, ratioZ;
	    double temp3, temp4, temp5, test1, test2, test3, factor1;
	    Graphics2D g2d = (Graphics2D)g;
            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
            FontMetrics fm;
	    x = 10;
	    y = 20;
	    dx = 80;
	    dxx = 15;
	    g.setFont(titlefont);
            g.setColor(Color.red.darker());
	    g.drawString("Input",20,20);
            
            
	}
    }
