//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);
    private static final Font labfont=new Font("SanSerif",Font.PLAIN,12);
    private static final Font labfontS=new Font("Serif",Font.PLAIN,13);
    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, 
          labeqa, labeqb, labeqc, labeqd, labeqe;
    Label vlab1;
    TextField text1, text2, text3, text4, text5, text6, text7;
    Button b1;
    // CHANGE ==============================================================
        public Button b2a, b2b, b3a, b3b;
    //======================================================================
    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(2,2,75,25);
	
	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.LEFT);
	labeqa.setFont(labfontbig);
	labeqb = new Label("=",Label.LEFT);
	labeqb.setFont(labfontbig);
        labeqc = new Label("=",Label.LEFT);
	labeqc.setFont(labfontbig);
        labeqd = new Label("=",Label.LEFT);
	labeqd.setFont(labfontbig);
	labeqe = new Label("=",Label.LEFT);
	labeqe.setFont(labfontbig);
        labHz = new Label("Hz",Label.LEFT);
	labHz.setFont(labfontbig);
        
	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(labfontS);
        labpb = new Label("|t|",Label.CENTER);
	labpb.setFont(labfontS);
        
        labpc = new Label("\u0393 , \u03c4",Label.CENTER);
	labpc.setFont(labfontS);
        labpd = new Label("tS",Label.CENTER);
	labpd.setFont(labfont);
        
        labpe = new Label("R , T",Label.CENTER);
	labpe.setFont(labfontS);
        labpf = new Label("T",Label.CENTER);
	labpf.setFont(labfontS);
        
	labscale = new Label("plot-zoom",Label.RIGHT);
	labscale.setFont(labfont);
        
        
        text1 = new TextField("1.0");
	text1.setFont(labfont);
	
	text2 = new TextField("1.0");
	text2.setFont(labfont);
	
	text3 = new TextField("0.0");
	text3.setFont(labfont);
	
	lab4 = new Label("\u03b5",Label.RIGHT);
	lab4.setFont(labfontbig);
	
	lab5 = new Label("\u03bc",Label.RIGHT);
	lab5.setFont(labfontbig);
	
	lab6 = new Label("Conductivity  \u03c3  = ",Label.RIGHT);
	lab6.setFont(labfont);
	
        lab10 = new Label("Field:",Label.RIGHT);
	lab10.setFont(labfont);
	
        text4 = new TextField("2.55");
	text4.setFont(labfont);
	
	text5 = new TextField("1.0");
	text5.setFont(labfont);
	
	text6 = new TextField("0.0");
	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,0,1,SCROLLMIN,901);
	slider2 = new Scrollbar(Scrollbar.HORIZONTAL,0,1,SCROLLMIN,1000);
        slider_scale = new Scrollbar(Scrollbar.HORIZONTAL,0,1,1,10);
        slider.setBackground(Color.white);
        slider2.setBackground(Color.white);
        slider_scale.setBackground(Color.white);
        slider_scale.setValue(0);
        slider.setValue(0);
	vlab1 = new Label("0 \u00ba",Label.LEFT);
	
	//add(titlelabel);
	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(labHz);
        //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);
        // CHANGE  =====================================================
                b2a = new Button("<");
                b2a.setBackground(bgcolor);        
                b2b = new Button(">");
                b2b.setBackground(bgcolor);
                b3a = new Button("<");
                b3a.setBackground(bgcolor);
                b3b = new Button(">");
                b3b.setBackground(bgcolor);
                add(b2a); add(b2b); add(b3a); add(b3b);
        //==============================================================
	add(lab8);
	add(lab9);
	add(slider);
        add(slider2);
        add(slider_scale);
	add(vlab1);
        
            
        //Draw the lines as panels - To avoid flickering on MAC --- MAC sucks!!!
        Panel back1 = new Panel();
	    back1.setBackground(Color.gray);
	    add(back1);
	    back1.setBounds(15,150,270,1);
        
        Panel back2 = new Panel();
	    back2.setBackground(Color.gray);
	    //add(back2);
	    back2.setBounds(15,169,270,1);
       
        Panel back3 = new Panel();
	    back3.setBackground(Color.gray);
	    add(back3);
	    back3.setBounds(15,215,270,1);
	
	//titlelabel.setBounds(5,25,290,25); 
	
	int ypos_block1 = 50;   
	text7.setBounds(55,ypos_block1+2,75,20);
	
        lab7.setBounds(10,ypos_block1+2,20,20);
        lab7.setFont(labfontbigI);
        labeqe.setBounds(40,ypos_block1+2,15,20);
        labHz.setBounds(132,ypos_block1+2,25,20);
        lab7.setForeground(Color.black);
        labeqe.setForeground(Color.black);
        labHz.setForeground(Color.black);
        
        b1.setBounds(195,ypos_block1+50,75,20);
        b1.setBackground(new Color(250,250,250));
        
        Panel pb1 = new Panel();
	    pb1.setBackground(Color.cyan);
	    add(pb1);
	    pb1.setBounds(194,ypos_block1+49,77,22);
	    
	Panel pb2 = new Panel();
	    pb2.setBackground(Color.black);
	    add(pb2);
	    pb2.setBounds(193,ypos_block1+48,79,24);
	        
        //-----------------------------------------
	
        int ypos_block2 = 80;
        lab1.setBounds(10,ypos_block2,20,20);
        labr1.setBounds(30,ypos_block2+5,10,20);
        labeqa.setBounds(40,ypos_block2,15,20);
        lab1.setForeground(Color.red.darker());
        labr1.setForeground(Color.red.darker());
        labeqa.setForeground(Color.red.darker());
        
	text1.setBounds(55,ypos_block2,75,20);
        text1.setForeground(Color.red.darker());
	lab2.setBounds(10,ypos_block2+22,20,20);
        labr2.setBounds(30,ypos_block2+28,10,20);
        labeqb.setBounds(40,ypos_block2+22,15,20);
        lab2.setForeground(Color.red.darker());
        labr2.setForeground(Color.red.darker());
        labeqb.setForeground(Color.red.darker());
        text2.setBounds(55,ypos_block2+22,75,20);
        text2.setForeground(Color.red.darker());
        
        labm1.setBounds(55,ypos_block2+44,65,15);
        labm2.setBounds(195,ypos_block2+44,65,15);
        lab4.setBounds(150,ypos_block2,20,20);
        labr3.setBounds(170,ypos_block2+5,10,20);
        labeqc.setBounds(180,ypos_block2,15,20);
        lab4.setForeground(Color.blue.darker());
        labr3.setForeground(Color.blue.darker());
        labeqc.setForeground(Color.blue.darker());
        
	text4.setBounds(195,ypos_block2,75,20); 
	text4.setForeground(Color.blue.darker());
        lab5.setBounds(150,ypos_block2+22,20,20);
        labr4.setBounds(170,ypos_block2+28,10,20);
        labeqd.setBounds(180,ypos_block2+22,15,20);
	lab5.setForeground(Color.blue.darker());
        labr4.setForeground(Color.blue.darker());
        labeqd.setForeground(Color.blue.darker());
        text5.setBounds(195,ypos_block2+22,75,20);
        text5.setForeground(Color.blue.darker());
	//---------------------------------------------
	int ypos_block3 = 165;
	lab9.setBounds(20,ypos_block3,80,15);
        lab3.setBounds(130,ypos_block3,160,15);
                
        c1.setBounds(65,ypos_block3+17,45,25);
	c2.setBounds(15,ypos_block3+17,45,25);
	c1.setBackground(bgcolor);
	c2.setBackground(bgcolor);
	
        c3.setBounds(135,ypos_block3+17,50,25);
	c3.setBackground(bgcolor);
	c4.setBounds(215,ypos_block3+17,55,25);
	c4.setBackground(bgcolor);
	//-------------------------------------------------------------------
	int ypos_block4 = 192;
        //c5.setBounds(110,ypos_block4,60,25);
	//c5.setBackground(bgcolor);
        //c6.setBounds(210,ypos_block4,60,25);
	//c6.setBackground(bgcolor);
        //c7.setBounds(30,ypos_block4,60,25);
	//c7.setBackground(bgcolor);
        labpa.setBounds(152,ypos_block4+5,55,15); 
        labpc.setBounds(252,ypos_block4+5,30,15); 
        labpe.setBounds(72,ypos_block4+5,30,15); 
        //------------------------------------------------------------------
        //int ypos_block5 = 171;
        //c8.setBounds(110,ypos_block5,80,25);
	//c8.setBackground(bgcolor);
        //c8.setForeground(Color.magenta.darker());
        //c9.setBounds(210,ypos_block5,80,25);
	//c9.setBackground(bgcolor);
        //c9.setForeground(Color.blue);
        //lab10.setBounds(45, ypos_block5+5, 60, 15);
        //------------------------------------------------------------------
        
	lab8.setBounds(50,224,120,15);
	
	slider.setBounds(20,244,260,15);
        slider2.setBounds(20,265,260,15);
        
        // CHANGE  =====================================================
                b2a.setBounds(20,244,14,15);
                b2b.setBounds(266,244,14,15);
                b3a.setBounds(20,265,14,15);
                b3b.setBounds(266,265,14,15);
        //==============================================================
                
        
        
        slider_scale.setBounds(195,57,75,15);
	scale2 = new Panel();
	    scale2.setBackground(Color.cyan);
	    add(scale2);
	    scale2.setBounds(194,56,77,17);
	scale1 = new Panel();
	    scale1.setBackground(Color.black);
	    add(scale1);
	    scale1.setBounds(193,55,79,19);
	add(scale2); add(scale1);  
        scale1.setVisible(true);
        scale2.setVisible(true);
        labscale.setVisible(true);
        slider_scale.setVisible(true);
        
        labscale.setBounds(180,35,80,15);
        add(labscale);
        
        vlab1.setBounds(180,224,80,15);
	
	Panel pslider2 = new Panel();
	    pslider2.setBackground(Color.cyan);
	    add(pslider2);
	    pslider2.setBounds(19,243,262,17);
	    
	Panel pslider1 = new Panel();
	    pslider1.setBackground(Color.black);
	    add(pslider1);
	    pslider1.setBounds(18,242,264,19);
	
        Panel pslider4 = new Panel();
	    pslider4.setBackground(Color.cyan);
	    add(pslider4);
	    pslider4.setBounds(19,264,262,17);
	    
	Panel pslider3 = new Panel();
	    pslider3.setBackground(Color.black);
	    add(pslider3);
	    pslider3.setBounds(18,263,264,19);
	
                
	//Listeners 
	slider.addAdjustmentListener(this);	
        slider2.addAdjustmentListener(this);
        slider_scale.addAdjustmentListener(this);
        
        // CHANGE ======================================================
                b2a.addActionListener(this);
                b2b.addActionListener(this);
                b3a.addActionListener(this);
                b3b.addActionListener(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){
	    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);
                //System.out.println("slider 1 "+MaestroA.rounder((180.0*state.theta1/Math.PI),5));
                state.ignition();
            }
	}
        if(evt.getSource()==slider2){
	    
		//state.theta1 = slider.getValue()*Math.PI/1800.0 +MaestroA.rounder(slider2.getValue()*Math.PI/180.0*0.0001,4);
		
                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 ");
                //System.out.println("slider 2 "+MaestroA.rounder((180.0*state.theta1/Math.PI),5));
                state.ignition();
	}
	//state.ignition();
    }

    
    public void actionPerformed(ActionEvent evt){
                // CHANGE - ADD THIS CODE ======================================
                if(evt.getSource()==b2a){
                    slider.setValue(slider.getValue()-1);
                    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);
                        //System.out.println("slider 1 "+MaestroA.rounder((180.0*state.theta1/Math.PI),5));
                        state.ignition();
                    }
                }
                else if(evt.getSource()==b2b){
                    slider.setValue(slider.getValue()+1);
                    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);
                        //System.out.println("slider 1 "+MaestroA.rounder((180.0*state.theta1/Math.PI),5));
                        state.ignition();
                    }
                    
                }
                else if(evt.getSource()==b3a){
                    slider2.setValue(slider2.getValue()-1);
                    
                    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();
                }
                else if(evt.getSource()==b3b){
                    slider2.setValue(slider2.getValue()+1);
                    
                    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();
                }
                //==============================================================
                
                if(evt.getSource() == b1){
                  
                  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");
                  }
                  
                    
		  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){
	g.setColor(Color.black);
	g.draw3DRect(0,0,getSize().width-1,getSize().height-1,true);
        
            //g.setColor(Color.gray);
            //g.drawLine(15,123,getSize().width-15,123);
            //g.drawLine(15,169,getSize().width-15,169);
            //g.drawLine(15,220,getSize().width-15,220);
        
        double radiusH = 6;
        double xpos = 280;
        double ypos2 = 195.0;
        double xpos2 = 195.0;
        double ypos = 195.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);
            
            
	}
    }