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

public class ObliqueOutputPanelB extends Panel {
	Oblique_State state;
	private static final Color bgcolor = new Color(200,250,250);//Color.lightGray.brighter();
	private static final Font labfont=new Font("Sanserif",Font.PLAIN,12);
	private static final Font titlefont=new Font("Sanserif",Font.BOLD,16);
	Label titlelabel;
	private Complex temp;	
        public Choice c1;
	
        public ObliqueOutputCanvasD pwocD;
        public ObliqueOutputCanvasE pwocE;
        public ObliqueOutputCanvasF pwocF;
        
        public ObliqueOutputPanelB(Oblique_State state){
	    super();
            setLayout(null);
	    setBackground(bgcolor);
	    this.state = state;
            //titlelabel.setForeground(Color.blue.darker());
	    //titlelabel = new Label("",Label.CENTER);
	    //add(titlelabel);
	    //titlelabel.setBounds(15,15,220,35);  
            //titlelabel.setBounds(1,1,150,25);  
	    //titlelabel.setFont(titlefont);
            
            pwocD = new ObliqueOutputCanvasD(state);
	    add(pwocD);
            
            pwocE = new ObliqueOutputCanvasE(state);
	    add(pwocE);
            
            pwocF = new ObliqueOutputCanvasF(state);
	    add(pwocF);
            
            pwocD.setBounds(1,1,374,79);
            pwocE.setBounds(1,1,374,79);
            pwocF.setBounds(1,1,374,79);
            
            pwocD.setVisible(true);
            pwocE.setVisible(true);
            pwocF.setVisible(true);
            
            //pwocD.setBackground(Color.yellow);
            
            
	}
	public void paint(Graphics g){
	    //g.draw3DRect(0,0,getSize().width-1,getSize().height-1,false);  
	}
   	
}//ObliqueOutputPanel.java

class ObliqueOutputCanvasD extends Canvas{
	
	private static final Font normalfont = new Font("Sanserif",Font.PLAIN,11);
        private static final Font normalfont2 = 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);
	private static final Font symbfont = new Font("Serif",Font.PLAIN,13);
	Oblique_State state;
	private Image im;
	private Graphics buf;
        
        public static int prec1 = 6;
        public static int prec2 = 6;

	public ObliqueOutputCanvasD(Oblique_State state){
	    super();
	    this.state = state;
	}
	public void paint(Graphics g){
            
	    if(im == null){
		im = createImage(getSize().width,getSize().height);
		buf = im.getGraphics();
		drawGraph(buf);
	    }
	    else{
		drawGraph(buf);
	    }
	    g.drawImage(im,0,0,null);
	}

	//Addition to reduce flicker new routine
	public void update(Graphics g){		// added to avoid clearing
	    paint(g);
	}

	public void drawGraph(Graphics g){
	    int x, x2, x3, x4, y, dx, dxx, dy, dyy;
	    Complex temp1, temp2;
	    double temp3, temp4, temp5, ratioZ, test1, test2, test3, factor1;
	    FontMetrics fm;
	    x = 5;
            x3 = 10;
            x4 = 35;
            x2 = 230;
	    y = 18;
	    dx = 80;
	    dxx = 15;
	    g.clearRect(0,0,getSize().width,getSize().height);
	    
            int fonto = 12;
	    g.setFont(titlefont);
            g.setColor(Color.blue.darker());
	    
	    g.setFont(normalfont2);
	    fm = g.getFontMetrics();
	    dy = 20;//fm.getHeight()-1;
	    dyy = dy+4;
	    
            double radiusH = 6;
            double xpos = x+10;
            double ypos2 = y+dy;
            double xpos2 = x+10;
            double ypos = y;
	    
            Graphics2D g2d = (Graphics2D)g;
            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
            
	    if(state.isPolarizationParallel){
                
                g.setFont(normalfont);
                fm = g.getFontMetrics();
                
                double R1, R2,R1_neg,R2_neg;
                Complex R3,R3_neg;
                R1 = MaestroA.rounder(Complex.Real(state.Reflection_CoefH),6);
                R2 = MaestroA.rounder(Complex.Imaginary(state.Reflection_CoefH),6);
                R3 = new Complex(R1,R2);
                R1_neg = MaestroA.rounder(-1.0*Complex.Real(state.Reflection_CoefH),6);
                R2_neg = MaestroA.rounder(-1.0*Complex.Imaginary(state.Reflection_CoefH),6);
                R3_neg = new Complex(R1_neg,R2_neg);
                    
                double T1, T2,T1_neg,T2_neg;
                Complex T3, T3_neg;
                T1 = MaestroA.rounder(Complex.Real(state.Transmission_CoefH),6);
                T2 = MaestroA.rounder(Complex.Imaginary(state.Transmission_CoefH),6);
                T3 = new Complex(T1,T2);
                T1_neg = MaestroA.rounder(-1.0*Complex.Real(state.Transmission_CoefH),6);
                T2_neg = MaestroA.rounder(-1.0*Complex.Imaginary(state.Transmission_CoefH),6);
                T3_neg = new Complex(T1_neg,T2_neg);
                
                double RE1, RE2, RE1_neg, RE2_neg;
                Complex RE3, RE3_neg;
                RE1 = MaestroA.rounder(Complex.Real(state.Reflection_Coef),6);
                RE2 = MaestroA.rounder(Complex.Imaginary(state.Reflection_Coef),6);
                RE3 = new Complex(RE1,RE2);
                RE1_neg = MaestroA.rounder(-1.0*Complex.Real(state.Reflection_Coef),6);
                RE2_neg = MaestroA.rounder(-1.0*Complex.Imaginary(state.Reflection_Coef),6);
                RE3_neg = new Complex(RE1_neg,RE2_neg);
                
                    
                double TE1, TE2,TE1_neg,TE2_neg;
                Complex TE3,TE3_neg;
                TE1 = MaestroA.rounder(Complex.Real(state.Transmission_Coef),6);
                TE2 = MaestroA.rounder(Complex.Imaginary(state.Transmission_Coef),6);
                TE3 = new Complex(TE1,TE2);
                TE1_neg = MaestroA.rounder(-1.0*Complex.Real(state.Transmission_Coef),6);
                TE2_neg = MaestroA.rounder(-1.0*Complex.Imaginary(state.Transmission_Coef),6);
                TE3_neg = new Complex(TE1_neg,TE2_neg);
                
                if(state.IsVectorIn){
                    
                    
                    g.setColor(Color.blue);
                    //MaestroG.subsubsubUn("","H","y"," = - H","0"," \u00e2","y","  [ A /m ]",g,fonto,x3,y);
                    MaestroG.supsubsubUn("H","i","//","y"," = - H","0"," y","^","  [ A /m ]",g,fonto,x3,y);
                    
                    y+= dyy;
                    
                   
                    if(state.theta1 < (state.totalR_angle*Math.PI/180.0)){
                        //MaestroG.subsubsubUn("","H","yR"," = "+MaestroA.rounder(R1_neg,6)+" H","0"," \u00e2","y","  [ A /m ]",g,fonto,x3,y);           
                        MaestroG.supsubsubUn("H","r","//","y"," = "+MaestroA.rounder(R1_neg,6)+" H","0"," y","^","  [ A /m ]",g,fonto,x3,y);           
                    }
                    else{
                        //MaestroG.subsubsubUn("","H","yR"," = ( "+R3_neg+" ) H","0"," \u00e2","y","  [ A /m ]",g,fonto,x3,y);                        
                        MaestroG.supsubsubUn("H","r","//","y"," = ( "+R3_neg+" ) H","0"," y","^","  [ A /m ]",g,fonto,x3,y);                        
                    }
                   
                    y+= dyy;
                        
                   if(state.theta1 < (state.totalR_angle*Math.PI/180.0)){
                        
                        //MaestroG.subsubsubUn("","H","yT"," = "+MaestroA.rounder(T1_neg,6)+" H","0"," \u00e2","y","  [ A /m ]",g,fonto,x3,y);
                        MaestroG.supsubsubUn("H","t","//","y"," = "+MaestroA.rounder(T1_neg,6)+" H","0"," y","^","  [ A /m ]",g,fonto,x3,y);
                    }
                    else{
                        
                        //MaestroG.subsubsubUn("","H","yT"," = ( "+T3_neg+" ) H","0"," \u00e2","y","  [ A /m ]",g,fonto,x3,y);
                        MaestroG.supsubsubUn("H","t","//","y"," = ( "+T3_neg+" ) H","0"," y","^","  [ A /m ]",g,fonto,x3,y);
                    }
                    
                }
                else{// flip incident direction
                    
                    g.setColor(Color.blue);
                    //MaestroG.subsubsubUn("","H","y"," = H","0"," \u00e2","y","  [ A /m ]",g,fonto,x3,y);
                    MaestroG.supsubsubUn("H","i","//","y"," = H","0"," y","^","  [ A /m ]",g,fonto,x3,y);
                    y+= dyy;
                    
                   
                    if(state.theta1 < (state.totalR_angle*Math.PI/180.0)){
                        //MaestroG.subsubsubUn("","H","yR"," = "+(MaestroA.rounder(R1,6))+" H","0"," \u00e2","y","  [ A /m ]",g,fonto,x3,y);                        
                        MaestroG.supsubsubUn("H","r","//","y"," = "+(MaestroA.rounder(R1,6))+" H","0"," y","^","  [ A /m ]",g,fonto,x3,y);                        
                    }
                    else{
                        //MaestroG.subsubsubUn("","H","yR"," = ( "+R3+" ) H","0"," \u00e2","y","  [ A /m ]",g,fonto,x3,y);
                        MaestroG.supsubsubUn("H","r","//","y"," = ( "+R3+" ) H","0"," y","^","  [ A /m ]",g,fonto,x3,y);
                    }
                    
                    y+= dyy;
                    if(state.theta1 < (state.totalR_angle*Math.PI/180.0)){
                        
                        //MaestroG.subsubsubUn("","H","yT"," = "+T1+" H","0"," \u00e2","y","  [ A /m ]",g,fonto,x3,y);
                        MaestroG.supsubsubUn("H","t","//","y"," = "+T1+" H","0"," y","^","  [ A /m ]",g,fonto,x3,y);
                    }
                    else{
                        
                        //MaestroG.subsubsubUn("","H","yT"," = ( "+T3+" ) H","0"," \u00e2","y","  [ A /m ]",g,fonto,x3,y);
                        MaestroG.supsubsubUn("H","t","//","y"," = ( "+T3+" ) H","0"," y","^","  [ A /m ]",g,fonto,x3,y);
                    }
                    
                }
            }
            else{
                g.setFont(normalfont);
                fm = g.getFontMetrics();
                
                double R1, R2,R1_neg,R2_neg;
                Complex R3,R3_neg;
                R1 = MaestroA.rounder(Complex.Real(state.Reflection_Coef),6);
                R2 = MaestroA.rounder(Complex.Imaginary(state.Reflection_Coef),6);
                R3 = new Complex(R1,R2);
                R1_neg = MaestroA.rounder(-1.0*Complex.Real(state.Reflection_Coef),6);
                R2_neg = MaestroA.rounder(-1.0*Complex.Imaginary(state.Reflection_Coef),6);
                R3_neg = new Complex(R1_neg,R2_neg);
                
                double T1, T2, T1_neg, T2_neg;
                Complex T3, T3_neg;
                T1 = MaestroA.rounder(Complex.Real(state.Transmission_Coef),6);
                T2 = MaestroA.rounder(Complex.Imaginary(state.Transmission_Coef),6);
                T3 = new Complex(T1,T2);
                T1_neg = MaestroA.rounder(-1.0*Complex.Real(state.Transmission_Coef),6);
                T2_neg = MaestroA.rounder(-1.0*Complex.Imaginary(state.Transmission_Coef),6);
                T3_neg = new Complex(T1_neg,T2_neg);
                
                double RE1, RE2,RE1_neg,RE2_neg;
                Complex RE3,RE3_neg;
                RE1 = MaestroA.rounder(Complex.Real(state.Reflection_CoefH),6);
                RE2 = MaestroA.rounder(Complex.Imaginary(state.Reflection_CoefH),6);
                RE3 = new Complex(RE1,RE2);
                RE1_neg = MaestroA.rounder(-1.0*Complex.Real(state.Reflection_CoefH),6);
                RE2_neg = MaestroA.rounder(-1.0*Complex.Imaginary(state.Reflection_CoefH),6);
                RE3_neg = new Complex(RE1_neg,RE2_neg);
                
                double TE1, TE2, TE1_neg, TE2_neg;
                Complex TE3, TE3_neg;
                TE1 = MaestroA.rounder(Complex.Real(state.Transmission_CoefH),6);
                TE2 = MaestroA.rounder(Complex.Imaginary(state.Transmission_CoefH),6);
                TE3 = new Complex(TE1,TE2);
                TE1_neg = MaestroA.rounder(-1.0*Complex.Real(state.Transmission_CoefH),6);
                TE2_neg = MaestroA.rounder(-1.0*Complex.Imaginary(state.Transmission_CoefH),6);
                TE3_neg = new Complex(TE1_neg,TE2_neg);
                
                if(state.IsVectorIn){
                    
                    g.setColor(Color.magenta.darker());
                    //MaestroG.subsubsubUn("","E","y"," = - E","0"," \u00e2","y","  [ V/m ]",g,fonto,x3,y);
                    MaestroG.supsubsubUn("E","i","","\u22a5y"," = - E","0"," y","^","  [ V/m ]",g,fonto,x3,y);
                    y+= dyy;
                    
                    if(state.theta1 < (state.totalR_angle*Math.PI/180.0)){
                        //MaestroG.subsubsubUn("","E","yR"," = "+R1_neg+" E","0"," \u00e2","y","  [ V/m ]",g,fonto,x3,y);           
                        MaestroG.supsubsubUn("E","r","","\u22a5y"," = "+R1_neg+" E","0"," y","^","  [ V/m ]",g,fonto,x3,y);           
                    }
                    else{
                        //MaestroG.subsubsubUn("","E","yR"," = ( "+R3_neg+" ) E","0"," \u00e2","y","  [ V/m ]",g,fonto,x3,y);                        
                        MaestroG.supsubsubUn("E","r","","\u22a5y"," = ( "+R3_neg+" ) E","0"," y","^","  [ V/m ]",g,fonto,x3,y);                        
                    }
                    
                    y+= dyy;
                    
                    if(state.theta1 < (state.totalR_angle*Math.PI/180.0)){
                        
                        //MaestroG.subsubsubUn("","E","yT"," = "+T1_neg+" E","0"," \u00e2","y","  [ V/m ]",g,fonto,x3,y);
                        MaestroG.supsubsubUn("E","t","","\u22a5y"," = "+T1_neg+" E","0"," y","^","  [ V/m ]",g,fonto,x3,y);
                    }
                    else{
                        
                        //MaestroG.subsubsubUn("","E","yT"," = ( "+T3_neg+" ) E","0"," \u00e2","y","  [ V/m ]",g,fonto,x3,y);
                        MaestroG.supsubsubUn("E","t","","\u22a5y"," = ( "+T3_neg+" ) E","0"," y","^","  [ V/m ]",g,fonto,x3,y);
                    }
                    
                }
                else{// flip incident direction
                    
                    g.setColor(Color.magenta.darker());
                    //MaestroG.subsubsubUn("","E","y"," = E","0"," \u00e2","y","  [ V/m ]",g,fonto,x3,y);
                    MaestroG.supsubsubUn("E","i","","\u22a5y"," = E","0"," y","^","  [ V/m ]",g,fonto,x3,y);
                    
                    y+= dyy;
                    
                    if(state.theta1 < (state.totalR_angle*Math.PI/180.0)){
                        //MaestroG.subsubsubUn("","E","yR"," = "+R1+" E","0"," \u00e2","y","  [ V/m ]",g,fonto,x3,y);                        
                        MaestroG.supsubsubUn("E","r","","\u22a5y"," = "+R1+" E","0"," y","^","  [ V/m ]",g,fonto,x3,y);                        
                    }
                    else{
                        //MaestroG.subsubsubUn("","E","yR"," = ( "+R3+" ) E","0"," \u00e2","y","  [ V/m ]",g,fonto,x3,y);
                        MaestroG.supsubsubUn("E","r","","\u22a5y"," = ( "+R3+" ) E","0"," y","^","  [ V/m ]",g,fonto,x3,y);
                    }
                    
                    y+= dyy;
                    
                    if(state.theta1 < (state.totalR_angle*Math.PI/180.0)){
                        
                        //MaestroG.subsubsubUn("","E","yT"," = "+T1+" E","0"," \u00e2","y","  [ V/m ]",g,fonto,x3,y);
                        MaestroG.supsubsubUn("E","t","","\u22a5y"," = "+T1+" E","0"," y","^","  [ V/m ]",g,fonto,x3,y);
                    }
                    else{
                        
                        //MaestroG.subsubsubUn("","E","yT"," = ( "+T3+" ) E","0"," \u00e2","y","  [ V/m ]",g,fonto,x3,y);
                        MaestroG.supsubsubUn("E","t","","\u22a5y"," = ( "+T3+" ) E","0"," y","^","  [ V/m ]",g,fonto,x3,y);
                    }
                      
                }
            }
	}
        
             public void Write(Graphics g, double test, int fonto, int x, int y){
            Graphics2D g2d = (Graphics2D)g;
            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
        
            
            //if(test < 1.0e-15){
		//MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e16,5)+"  x  10","-16"," ",g,fonto,x,y);
	    //}
            if(test < 1.0e-15){
		MaestroG.superscripter("  =  0.0",""," ",g,fonto,x,y);
	    }
            else if(test >= 1.0e-15 && test < 1.0e-14){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e15,5)+"  x  10","-15"," ",g,fonto,x,y);
	    }
            else if(test >= 1.0e-14 && test < 1.0e-13){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e14,5)+"  x  10","-14"," ",g,fonto,x,y);
	    }
            else if(test >= 1.0e-13 && test < 1.0e-12){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e13,5)+"  x  10","-13"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-12 && test < 1.0e-11){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e12,5)+"  x  10","-12"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-11 && test < 1.0e-10){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e11,5)+"  x  10","-11"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-10 && test < 1.0e-9){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e10,5)+"  x  10","-10"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-9 && test < 1.0e-8){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e9,5)+"  x  10","-9"," ",g,fonto,x,y);
	    }
	    
	    else if(test >= 1.0e-8 && test < 1.0e-7){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e8,5)+"  x  10","-8"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-7 && test < 1.0e-6){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e7,5)+"  x  10","-7"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-6 && test < 1.0e-5){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e6,5)+"  x  10","-6"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-5 && test < 1.0e-4){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e5,5)+"  x  10","-5"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-4 && test < 1.0e-3){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e4,5)+"  x  10","-4"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-3 && test < 1.0e-2){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e3,5)+"  x  10","-3"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-2 && test < 1.0e-1){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e2,5)+"  x  10","-2"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-1 && test < 1.0){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e1,5)+"  x  10","-1"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0 && test < 1.0e1){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test,5)+"  ",""," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e1 && test < 1.0e2){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test,5)+"  ",""," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e2 && test < 1.0e3){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-2,5)+"  x  10","2"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e3 && test < 1.0e4){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-3,5)+"  x  10","3"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e4 && test < 1.0e5){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-4,5)+"  x  10","4"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e5 && test < 1.0e6){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-5,5)+"  x  10","5"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e6 && test < 1.0e7){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-6,5)+"  x  10","6"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e7 && test < 1.0e8){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-7,5)+"  x  10","7"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e8 && test < 1.0e9){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-8,5)+"  x  10","8"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e9 && test < 1.0e10){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-9,5)+"  x  10","9"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e10 && test < 1.0e11){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-10,5)+"  x  10","10"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e11 && test < 1.0e12){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-11,5)+"  x  10","11"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e12 && test < 1.0e13){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-12,5)+"  x  10","12"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e13 && test < 1.0e14){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-13,5)+"  x  10","13"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e14 && test < 1.0e15){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-14,5)+"  x  10","14"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e15 && test < 1.0e16){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-15,5)+"  x  10","15"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e16 && test < 1.0e17){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-16,5)+"  x  10","16"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e17 && test < 1.0e18){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-17,5)+"  x  10","17"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e18 && test < 1.0e19){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-18,5)+"  x  10","18"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e19 && test < 1.0e20){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-19,5)+"  x  10","19"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e20 && test < 1.0e21){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-20,5)+"  x  10","20"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e21){
		MaestroG.superscripter("  =  "+test+"",""," ",g,fonto,x,y);
	    }
            
            //g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_OFF);
        }

        public void WriteC(Graphics g, double test, int fonto, int x, int y){
            Graphics2D g2d = (Graphics2D)g;
            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
        
            
            //if(test < 1.0e-15){
		//MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e16,5)+"  x  10","-16"," ",g,fonto,x,y);
	    //}
            if(test < 1.0e-15){
		MaestroG.superscripter("  =  0.0",""," ",g,fonto,x,y);
	    }
            else if(test >= 1.0e-15 && test < 1.0e-14){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e15,5)+"  x  10","-15"," ",g,fonto,x,y);
	    }
            else if(test >= 1.0e-14 && test < 1.0e-13){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e14,5)+"  x  10","-14"," ",g,fonto,x,y);
	    }
            else if(test >= 1.0e-13 && test < 1.0e-12){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e13,5)+"  x  10","-13"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-12 && test < 1.0e-11){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e12,5)+"  x  10","-12"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-11 && test < 1.0e-10){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e11,5)+"  x  10","-11"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-10 && test < 1.0e-9){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e10,5)+"  x  10","-10"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-9 && test < 1.0e-8){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e9,5)+"  x  10","-9"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-8 && test < 1.0e-7){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e8,5)+"  x  10","-8"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-7 && test < 1.0e-6){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e7,5)+"  x  10","-7"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-6 && test < 1.0e-5){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e6,5)+"  x  10","-6"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-5 && test < 1.0e-4){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e5,5)+"  x  10","-5"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-4 && test < 1.0e-3){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e4,5)+"  x  10","-4"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-3 && test < 1.0e-2){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e3,5)+"  x  10","-3"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-2 && test < 1.0e-1){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e2,5)+"  x  10","-2"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-1 && test < 1.0){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e1,5)+"  x  10","-1"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0 && test < 1.0e1){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test,5)+"  ",""," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e1 && test < 1.0e2){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test,5)+"  ",""," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e2 && test < 1.0e3){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-2,5)+"  x  10","2"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e3 && test < 1.0e4){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-3,5)+"  x  10","3"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e4 && test < 1.0e5){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-4,5)+"  x  10","4"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e5 && test < 1.0e6){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-5,5)+"  x  10","5"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e6 && test < 1.0e7){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-6,5)+"  x  10","6"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e7 && test < 1.0e8){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-7,5)+"  x  10","7"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e8 && test < 1.0e9){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-8,5)+"  x  10","8"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e9 && test < 1.0e10){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-9,5)+"  x  10","9"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e10 && test < 1.0e11){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-10,5)+"  x  10","10"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e11 && test < 1.0e12){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-11,5)+"  x  10","11"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e12 && test < 1.0e13){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-12,5)+"  x  10","12"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e13 && test < 1.0e14){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-13,5)+"  x  10","13"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e14 && test < 1.0e15){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-14,5)+"  x  10","14"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e15 && test < 1.0e16){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-15,5)+"  x  10","15"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e16 && test < 1.0e17){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-16,5)+"  x  10","16"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e17 && test < 1.0e18){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-17,5)+"  x  10","17"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e18 && test < 1.0e19){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-18,5)+"  x  10","18"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e19 && test < 1.0e20){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-19,5)+"  x  10","19"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e20 && test < 1.0e21){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-20,5)+"  x  10","20"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e21){
		MaestroG.superscripter("  =  - j "+test+"",""," ",g,fonto,x,y);
	    }
            
            //g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_OFF);
        }
}

class ObliqueOutputCanvasE extends Canvas{
	
	private static final Font normalfont = new Font("Sanserif",Font.PLAIN,11);
        private static final Font normalfont2 = 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);
	private static final Font symbfont = new Font("Serif",Font.PLAIN,13);
	Oblique_State state;
	private Image im;
	private Graphics buf;
        
        public static int prec1 = 6;
        public static int prec2 = 6;

	public ObliqueOutputCanvasE(Oblique_State state){
	    super();
	    this.state = state;
	}
	public void paint(Graphics g){
	    if(im == null){
		im = createImage(getSize().width,getSize().height);
		buf = im.getGraphics();
		drawGraph(buf);
	    }
	    else{
		drawGraph(buf);
	    }
	    g.drawImage(im,0,0,null);
	}

	//Addition to reduce flicker new routine
	public void update(Graphics g){		// added to avoid clearing
	    paint(g);
	}

	public void drawGraph(Graphics g){
	    int x, x2, x3, x4, y, dx, dxx, dy, dyy;
	    Complex temp1, temp2;
	    double temp3, temp4, temp5, ratioZ, test1, test2, test3, factor1;
	    FontMetrics fm;
	    x = 5;
            x3 = 10;
            x4 = 35;
            x2 = 230;
	    y = 18;
	    dx = 80;
	    dxx = 15;
	    g.clearRect(0,0,getSize().width,getSize().height);
	    int fonto = 12;
	    g.setFont(titlefont);
            g.setColor(Color.blue.darker());
	    
	    g.setFont(normalfont2);
	    fm = g.getFontMetrics();
	    dy = 20;//fm.getHeight()-1;
	    dyy = dy+4;
	    
            double radiusH = 6;
            double xpos = x+10;
            double ypos2 = y+dy;
            double xpos2 = x+10;
            double ypos = y;
	    
	    if(state.isPolarizationParallel){
                
                g.setFont(normalfont);
                fm = g.getFontMetrics();
                
                double R1, R2;
                Complex R3;
                R1 = MaestroA.rounder(Complex.Real(state.Reflection_CoefH),6);
                R2 = MaestroA.rounder(Complex.Imaginary(state.Reflection_CoefH),6);
                R3 = new Complex(R1,R2);
                    
                double T1, T2;
                Complex T3;
                T1 = MaestroA.rounder(Complex.Real(state.Transmission_CoefH),6);
                T2 = MaestroA.rounder(Complex.Imaginary(state.Transmission_CoefH),6);
                T3 = new Complex(T1,T2);
                
                double RE1, RE2;
                Complex RE3;
                RE1 = MaestroA.rounder(Complex.Real(state.Reflection_Coef),6);
                RE2 = MaestroA.rounder(Complex.Imaginary(state.Reflection_Coef),6);
                RE3 = new Complex(RE1,RE2);
                    
                double TE1, TE2;
                Complex TE3;
                TE1 = MaestroA.rounder(Complex.Real(state.Transmission_Coef),6);
                TE2 = MaestroA.rounder(Complex.Imaginary(state.Transmission_Coef),6);
                TE3 = new Complex(TE1,TE2);
                Graphics2D g2d = (Graphics2D)g;
                g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
            
                if(state.IsVectorIn){
                    
                    g.setColor(Color.magenta.darker());
                    
                    //MaestroG.subsubsubUn("","E","x"," = "+MaestroA.rounder((-1.0)*Complex.Real(state.wave_impedance1)*Math.cos(state.theta1),6)+" H","0"," \u00e2","x","  [ V/m ]",g,fonto,x3,y);
                    MaestroG.supsubsubUn("E","i","//","x"," = "+MaestroA.rounder((-1.0)*Complex.Real(state.wave_impedance1)*Math.cos(state.theta1),6)+" H","0"," x","^","  [ V/m ]",g,fonto,x3,y);
                    y+= dyy;
                    
                   if(state.theta1 < (state.totalR_angle*Math.PI/180.0)){
                        
                        //MaestroG.subsubsubUn("","E","xR"," = "+MaestroA.rounder(Complex.Real(state.wave_impedance1)*
                          //                                    Math.cos(state.theta1)*MaestroA.rounder(R1,6),6)+" H","0"," \u00e2","x","  [ V/m ]",g,fonto,x3,y);
                        MaestroG.supsubsubUn("E","r","//","x"," = "+MaestroA.rounder(Complex.Real(state.wave_impedance1)*
                                                              Math.cos(state.theta1)*MaestroA.rounder(R1,6),6)+" H","0"," x","^","  [ V/m ]",g,fonto,x3,y);
                        
                    }
                    else{
                        
                        String tmpx, tmpz;
                        Complex Ctempx, Ctempz;
                        
                        Ctempz = Complex.Multiply(Complex.Multiply(Math.cos(state.theta1),RE3),state.wave_impedance1);
                        Ctempx = Complex.Multiply(Complex.Multiply(Math.sin(state.theta1),RE3),state.wave_impedance1);
                        
                        if(Ctempz.Imaginary()>=0.0){
                            tmpz = String.valueOf(MaestroA.rounder((-1.0)*Ctempz.Real(),prec2))+" - j "+String.valueOf(MaestroA.rounder(Math.abs(Ctempz.Imaginary()),prec2));
                        }
                        else {
                            tmpz = String.valueOf(MaestroA.rounder((-1.0)*Ctempz.Real(),prec2))+" + j "+String.valueOf(MaestroA.rounder(Math.abs(Ctempz.Imaginary()),prec2));
                        }
                        
                        //MaestroG.subsubsubUn("","E","xR"," = ( "+tmpz+" ) H","0"," \u00e2","x","  [ V/m ]",g,fonto,x3,y);
                        MaestroG.supsubsubUn("E","r","//","x"," = ( "+tmpz+" ) H","0"," x","^","  [ V/m ]",g,fonto,x3,y);
                    }
                    
                    y+= dyy;
                        
                    if(state.theta1 < (state.totalR_angle*Math.PI/180.0)){
                        //MaestroG.subsubsubUn("","E","xT"," = "+MaestroA.rounder((-1.0)*Complex.Real(state.wave_impedance2)*
                          //                                    Math.cos(state.theta2)*MaestroA.rounder(T1,6),6)+" H","0"," \u00e2","x","  [ V/m ]",g,fonto,x3,y);
                        MaestroG.supsubsubUn("E","t","//","x"," = "+MaestroA.rounder((-1.0)*Complex.Real(state.wave_impedance2)*
                                                              Math.cos(state.theta2)*MaestroA.rounder(T1,6),6)+" H","0"," x","^","  [ V/m ]",g,fonto,x3,y);
                        
                    }
                    else{
                        
                        String tmpx, tmpz;
                        Complex Ctempx, Ctempz, CtempTot;
                        Ctempz = Complex.Add(MaestroA.rounder(Complex.Real(state.wave_impedance1)*Math.cos(state.theta1),6),
                                                  Complex.Multiply(Complex.Multiply(Math.cos(state.theta1),RE3),state.wave_impedance1)
                                                 );
                        
                        Ctempz = Complex.Multiply(-1.0,Ctempz);
                        
                        Ctempx = Complex.Multiply(Complex.Subtract(MaestroA.rounder(Complex.Real(state.wave_impedance1)*Math.sin(state.theta1),6),
                                                  Complex.Multiply(Complex.Multiply(Math.sin(state.theta1),RE3),state.wave_impedance1)
                                                 ), state.epsilon_r1/state.epsilon_r2);
                        
                        CtempTot = Complex.Add(Ctempx,Ctempz);
                        
                        if(Ctempx.Imaginary()>=0.0){
                            tmpz = String.valueOf(MaestroA.rounder(Ctempz.Real(),prec2))+" + j "+String.valueOf(MaestroA.rounder(Math.abs(Ctempz.Imaginary()),prec2));
                        }
                        else {
                            tmpz = String.valueOf(MaestroA.rounder(Ctempz.Real(),prec2))+" - j "+String.valueOf(MaestroA.rounder(Math.abs(Ctempz.Imaginary()),prec2));
                        }
                        //MaestroG.subsubsubUn("","E","xT"," = ( "+tmpz+" ) H","0"," \u00e2","x","  [ V/m ]",g,fonto,x3,y);
                        MaestroG.supsubsubUn("E","t","//","x"," = ( "+tmpz+" ) H","0"," x","^","  [ V/m ]",g,fonto,x3,y);
                        
                    }
                    
                }
                else{// flip incident direction
                    
                    g.setColor(Color.magenta.darker());
                    //MaestroG.subsubsubUn("","E","x"," = "+MaestroA.rounder(Complex.Real(state.wave_impedance1)*Math.cos(state.theta1),6)+" H","0"," \u00e2","x","  [ V/m ]",g,fonto,x3,y);
                    MaestroG.supsubsubUn("E","i","//","x"," = "+MaestroA.rounder(Complex.Real(state.wave_impedance1)*Math.cos(state.theta1),6)+" H","0"," x","^","  [ V/m ]",g,fonto,x3,y);
                    y+= dyy;
                    
                    if(state.theta1 < (state.totalR_angle*Math.PI/180.0)){
                        
                        //MaestroG.subsubsubUn("","E","xR"," = "+MaestroA.rounder((-1.0)*Complex.Real(state.wave_impedance1)*
                          //                                    Math.cos(state.theta1)*MaestroA.rounder(R1,6),6)+" H","0"," \u00e2","x","  [ V/m ]",g,fonto,x3,y);
                        MaestroG.supsubsubUn("E","r","//","x"," = "+MaestroA.rounder((-1.0)*Complex.Real(state.wave_impedance1)*
                                                              Math.cos(state.theta1)*MaestroA.rounder(R1,6),6)+" H","0"," x","^","  [ V/m ]",g,fonto,x3,y);
                        
                    }
                    else{
                        
                        String tmpx, tmpz;
                        Complex Ctempx, Ctempz;
                        Ctempz = Complex.Multiply(Complex.Multiply(Math.cos(state.theta1),RE3),state.wave_impedance1);
                        Ctempx = Complex.Multiply(Complex.Multiply(Math.sin(state.theta1),RE3),state.wave_impedance1);
                        
                        if(Ctempz.Imaginary()>=0.0){
                            tmpz = String.valueOf(MaestroA.rounder(Ctempz.Real(),prec2))+" + j "+String.valueOf(MaestroA.rounder(Math.abs(Ctempz.Imaginary()),prec2));
                        }
                        else {
                            tmpz = String.valueOf(MaestroA.rounder(Ctempz.Real(),prec2))+" - j "+String.valueOf(MaestroA.rounder(Math.abs(Ctempz.Imaginary()),prec2));
                        }
                        
                        //MaestroG.subsubsubUn("","E","xR"," = ( "+tmpz+" ) H","0"," \u00e2","x","  [ V/m ]",g,fonto,x3,y);
                        MaestroG.supsubsubUn("E","r","//","x"," = ( "+tmpz+" ) H","0"," x","^","  [ V/m ]",g,fonto,x3,y);
                    }
                    
                    y+= dyy;
                    if(state.theta1 < (state.totalR_angle*Math.PI/180.0)){
                        //MaestroG.subsubsubUn("","E","xT"," = "+MaestroA.rounder(Complex.Real(state.wave_impedance2)*
                          //                                    Math.cos(state.theta2)*MaestroA.rounder(T1,6),6)+" H","0"," \u00e2","x","  [ V/m ]",g,fonto,x3,y);
                        MaestroG.supsubsubUn("E","t","//","x"," = "+MaestroA.rounder(Complex.Real(state.wave_impedance2)*
                                                              Math.cos(state.theta2)*MaestroA.rounder(T1,6),6)+" H","0"," x","^","  [ V/m ]",g,fonto,x3,y);
                        
                    }
                    else{
                        String tmpx, tmpz;
                        Complex Ctempx, Ctempz, CtempTot;
                        Ctempz = Complex.Add(MaestroA.rounder(Complex.Real(state.wave_impedance1)*Math.cos(state.theta1),6),
                                                  Complex.Multiply(Complex.Multiply(Math.cos(state.theta1),RE3),state.wave_impedance1)
                                                 );
                        
                        Ctempx = Complex.Multiply(Complex.Subtract(MaestroA.rounder(Complex.Real(state.wave_impedance1)*Math.sin(state.theta1),6),
                                                  Complex.Multiply(Complex.Multiply(Math.sin(state.theta1),RE3),state.wave_impedance1)
                                                 ), state.epsilon_r1/state.epsilon_r2);
                        
                        Ctempx = Complex.Multiply(-1.0,Ctempx);
                        
                        CtempTot = Complex.Add(Ctempx,Ctempz);
                        
                        if(Ctempx.Imaginary()>=0.0){
                            tmpz = String.valueOf(MaestroA.rounder(Ctempz.Real(),prec2))+" + j "+String.valueOf(MaestroA.rounder(Math.abs(Ctempz.Imaginary()),prec2));
                        }
                        else {
                            tmpz = String.valueOf(MaestroA.rounder(Ctempz.Real(),prec2))+" - j "+String.valueOf(MaestroA.rounder(Math.abs(Ctempz.Imaginary()),prec2));
                        }
                        //MaestroG.subsubsubUn("","E","xT"," = ( "+tmpz+" ) H","0"," \u00e2","x","  [ V/m ]",g,fonto,x3,y);
                        MaestroG.supsubsubUn("E","t","//","x"," = ( "+tmpz+" ) H","0"," x","^","  [ V/m ]",g,fonto,x3,y);
                    }
                    
                }
            }
            else{
                g.setFont(normalfont);
                fm = g.getFontMetrics();
                
                double R1, R2;
                Complex R3;
                R1 = MaestroA.rounder(Complex.Real(state.Reflection_Coef),6);
                R2 = MaestroA.rounder(Complex.Imaginary(state.Reflection_Coef),6);
                R3 = new Complex(R1,R2);
                    
                double T1, T2;
                Complex T3;
                T1 = MaestroA.rounder(Complex.Real(state.Transmission_Coef),6);
                T2 = MaestroA.rounder(Complex.Imaginary(state.Transmission_Coef),6);
                T3 = new Complex(T1,T2);
                
                double RE1, RE2;
                Complex RE3;
                RE1 = MaestroA.rounder(Complex.Real(state.Reflection_CoefH),6);
                RE2 = MaestroA.rounder(Complex.Imaginary(state.Reflection_CoefH),6);
                RE3 = new Complex(RE1,RE2);
                    
                double TE1, TE2;
                Complex TE3;
                TE1 = MaestroA.rounder(Complex.Real(state.Transmission_CoefH),6);
                TE2 = MaestroA.rounder(Complex.Imaginary(state.Transmission_CoefH),6);
                TE3 = new Complex(TE1,TE2);
                
                if(state.IsVectorIn){
                    
                    g.setColor(Color.blue);
                    //MaestroG.subsubsubUn("","H","x"," = "+MaestroA.rounder(1.0/Complex.Real(state.wave_impedance1)*Math.cos(state.theta1),6)+" E","0"," \u00e2","x","  [ A /m ]",g,fonto,x3,y);
                    MaestroG.supsubsubUn("H","i","","\u22a5x"," = "+MaestroA.rounder(1.0/Complex.Real(state.wave_impedance1)*Math.cos(state.theta1),6)+" E","0"," x","^","  [ A /m ]",g,fonto,x3,y);
                    y+= dyy;
                    
                    if(state.theta1 < (state.totalR_angle*Math.PI/180.0)){
                        
                        //MaestroG.subsubsubUn("","H","xR"," = "+MaestroA.rounder((-1.0)/Complex.Real(state.wave_impedance1)*
                            //                                  Math.cos(state.theta1)*MaestroA.rounder(R1,6),6)+" E","0"," \u00e2","x","  [ A /m ]",g,fonto,x3,y);
                        MaestroG.supsubsubUn("H","r","","\u22a5x"," = "+MaestroA.rounder((-1.0)/Complex.Real(state.wave_impedance1)*
                                                              Math.cos(state.theta1)*MaestroA.rounder(R1,6),6)+" E","0"," x","^","  [ A /m ]",g,fonto,x3,y);
                        
                    }
                    else{
                        String tmpx, tmpz;
                        Complex Ctempx, Ctempz;
                        Ctempz = Complex.Divide(Complex.Multiply(Math.cos(state.theta1),RE3),state.wave_impedance1);
                        Ctempx = Complex.Divide(Complex.Multiply(Math.sin(state.theta1),RE3),state.wave_impedance1);
                        
                        if(Ctempz.Imaginary()>=0.0){
                            tmpz = String.valueOf(MaestroA.rounder(Ctempz.Real(),prec2))+" + j "+String.valueOf(MaestroA.rounder(Math.abs(Ctempz.Imaginary()),prec2));
                        }
                        else {
                            tmpz = String.valueOf(MaestroA.rounder(Ctempz.Real(),prec2))+" - j "+String.valueOf(MaestroA.rounder(Math.abs(Ctempz.Imaginary()),prec2));
                        }
                        
                        //MaestroG.subsubsubUn("","H","xR"," = ( "+tmpz+" ) E","0"," \u00e2","x","  [ A /m ]",g,fonto,x3,y);
                        MaestroG.supsubsubUn("H","r","","\u22a5x"," = ( "+tmpz+" ) E","0"," x","^","  [ A /m ]",g,fonto,x3,y);
                    }
                    
                    y+= dyy;
                    
                    if(state.theta1 < (state.totalR_angle*Math.PI/180.0)){
                        //MaestroG.subsubsubUn("","H","xT"," = "+MaestroA.rounder(1.0/Complex.Real(state.wave_impedance2)*
                          //                                    Math.cos(state.theta2)*MaestroA.rounder(T1,6),6)+" E","0"," \u00e2","x","  [ A /m ]",g,fonto,x3,y);
                        MaestroG.supsubsubUn("H","t","","\u22a5x"," = "+MaestroA.rounder(1.0/Complex.Real(state.wave_impedance2)*
                                                              Math.cos(state.theta2)*MaestroA.rounder(T1,6),6)+" E","0"," x","^","  [ A /m ]",g,fonto,x3,y);
                    }
                    else{
                        
                        String tmpx, tmpz;
                        Complex Ctempx, Ctempz, CtempTot;
                        Ctempz = Complex.Add(MaestroA.rounder(Math.cos(state.theta1)/Complex.Real(state.wave_impedance1),6),
                                                  Complex.Divide(Complex.Multiply(Math.cos(state.theta1),RE3),state.wave_impedance1)
                                                 );
                                 
                        Ctempx = Complex.Multiply(Complex.Subtract(MaestroA.rounder(Math.sin(state.theta1)/Complex.Real(state.wave_impedance1),6),
                                                  Complex.Divide(Complex.Multiply(Math.sin(state.theta1),RE3),state.wave_impedance1)
                                                 ), state.mu_r1/state.mu_r2);
                        Ctempx = Complex.Multiply(-1.0,Ctempx);
                        
                        CtempTot = Complex.Add(Ctempx,Ctempz);
                        
                        if(Ctempx.Imaginary()>=0.0){
                            tmpz = String.valueOf(MaestroA.rounder(Ctempz.Real(),prec2))+" + j "+String.valueOf(MaestroA.rounder(Math.abs(Ctempz.Imaginary()),prec2));
                        }
                        else {
                            tmpz = String.valueOf(MaestroA.rounder(Ctempz.Real(),prec2))+" - j "+String.valueOf(MaestroA.rounder(Math.abs(Ctempz.Imaginary()),prec2));
                        }
                        //MaestroG.subsubsubUn("","H","xT"," = ( "+tmpz+" ) E","0"," \u00e2","x","  [ A /m ]",g,fonto,x3,y);
                        MaestroG.supsubsubUn("H","t","","\u22a5x"," = ( "+tmpz+" ) E","0"," x","^","  [ A /m ]",g,fonto,x3,y);
                    }
                    
                }
                else{// flip incident direction
                    
                    g.setColor(Color.blue);
                    //MaestroG.subsubsubUn("","H","x"," = "+MaestroA.rounder((-1.0)/Complex.Real(state.wave_impedance1)*Math.cos(state.theta1),6)+" E","0"," \u00e2","x","  [ A /m ]",g,fonto,x3,y);
                    MaestroG.supsubsubUn("H","i","","\u22a5x"," = "+MaestroA.rounder((-1.0)/Complex.Real(state.wave_impedance1)*Math.cos(state.theta1),6)+" E","0"," x","^","  [ A /m ]",g,fonto,x3,y);
                    y+= dyy;
                    
                    if(state.theta1 < (state.totalR_angle*Math.PI/180.0)){
                        
                        //MaestroG.subsubsubUn("","H","xR"," = "+MaestroA.rounder(1.0/Complex.Real(state.wave_impedance1)*
                          //                                    Math.cos(state.theta1)*MaestroA.rounder(R1,6),6)+" E","0"," \u00e2","x","  [ A /m ]",g,fonto,x3,y);
                        MaestroG.supsubsubUn("H","r","","\u22a5x"," = "+MaestroA.rounder(1.0/Complex.Real(state.wave_impedance1)*
                                                              Math.cos(state.theta1)*MaestroA.rounder(R1,6),6)+" E","0"," x","^","  [ A /m ]",g,fonto,x3,y);
                        
                    }
                    else{
                        String tmpx, tmpz;
                        Complex Ctempx, Ctempz;
                        Ctempz = Complex.Divide(Complex.Multiply(Math.cos(state.theta1),RE3),state.wave_impedance1);
                        Ctempx = Complex.Divide(Complex.Multiply(Math.sin(state.theta1),RE3),state.wave_impedance1);
                        
                        if(Ctempz.Imaginary()>=0.0){
                            tmpz = String.valueOf(MaestroA.rounder((-1.0)*Ctempz.Real(),prec2))+" - j "+String.valueOf(MaestroA.rounder(Math.abs(Ctempz.Imaginary()),prec2));
                        }
                        else {
                            tmpz = String.valueOf(MaestroA.rounder((-1.0)*Ctempz.Real(),prec2))+" + j "+String.valueOf(MaestroA.rounder(Math.abs(Ctempz.Imaginary()),prec2));
                        }
                        
                        //MaestroG.subsubsubUn("","H","xR"," = ( "+tmpz+" ) E","0"," \u00e2","x","  [ A /m ]",g,fonto,x3,y);
                        MaestroG.supsubsubUn("H","r","","\u22a5x"," = ( "+tmpz+" ) E","0"," x","^","  [ A /m ]",g,fonto,x3,y);
                    }
                    
                    y+= dyy;
                    
                    if(state.theta1 < (state.totalR_angle*Math.PI/180.0)){
                        //MaestroG.subsubsubUn("","H","xT"," = "+MaestroA.rounder((-1.0)/Complex.Real(state.wave_impedance2)*
                          //                                    Math.cos(state.theta2)*MaestroA.rounder(T1,6),6)+" E","0"," \u00e2","x","  [ A /m ]",g,fonto,x3,y);
                        MaestroG.supsubsubUn("H","t","","\u22a5x"," = "+MaestroA.rounder((-1.0)/Complex.Real(state.wave_impedance2)*
                                                              Math.cos(state.theta2)*MaestroA.rounder(T1,6),6)+" E","0"," x","^","  [ A /m ]",g,fonto,x3,y);
                        
                    }
                    else{
                        
                        String tmpx, tmpz;
                        Complex Ctempx, Ctempz, CtempTot;
                        Ctempz = Complex.Add(MaestroA.rounder(Math.cos(state.theta1)/Complex.Real(state.wave_impedance1),6),
                                                  Complex.Divide(Complex.Multiply(Math.cos(state.theta1),RE3),state.wave_impedance1)
                                                 );
                        
                        Ctempz = Complex.Multiply(-1.0,Ctempz);
                                 
                        Ctempx = Complex.Multiply(Complex.Subtract(MaestroA.rounder(Math.sin(state.theta1)/Complex.Real(state.wave_impedance1),6),
                                                  Complex.Divide(Complex.Multiply(Math.sin(state.theta1),RE3),state.wave_impedance1)
                                                 ), state.mu_r1/state.mu_r2);
                        
                         CtempTot = Complex.Add(Ctempx,Ctempz);
                        
                        if(Ctempx.Imaginary()>=0.0){
                            tmpz = String.valueOf(MaestroA.rounder(Ctempz.Real(),prec2))+" + j "+String.valueOf(MaestroA.rounder(Math.abs(Ctempz.Imaginary()),prec2));
                        }
                        else {
                            tmpz = String.valueOf(MaestroA.rounder(Ctempz.Real(),prec2))+" - j "+String.valueOf(MaestroA.rounder(Math.abs(Ctempz.Imaginary()),prec2));
                        }
                        //MaestroG.subsubsubUn("","H","xT"," = ( "+tmpz+" ) E","0"," \u00e2","x","  [ A /m ]",g,fonto,x3,y);
                        MaestroG.supsubsubUn("H","t","","\u22a5x"," = ( "+tmpz+" ) E","0"," x","^","  [ A /m ]",g,fonto,x3,y);
                    }  
                }
            }
	}
        
        public void Write(Graphics g, double test, int fonto, int x, int y){
                    Graphics2D g2d = (Graphics2D)g;
                    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
        
            
            //if(test < 1.0e-15){
		//MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e16,5)+"  x  10","-16"," ",g,fonto,x,y);
	    //}
            if(test < 1.0e-15){
		MaestroG.superscripter("  =  0.0",""," ",g,fonto,x,y);
	    }
            else if(test >= 1.0e-15 && test < 1.0e-14){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e15,5)+"  x  10","-15"," ",g,fonto,x,y);
	    }
            else if(test >= 1.0e-14 && test < 1.0e-13){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e14,5)+"  x  10","-14"," ",g,fonto,x,y);
	    }
            else if(test >= 1.0e-13 && test < 1.0e-12){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e13,5)+"  x  10","-13"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-12 && test < 1.0e-11){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e12,5)+"  x  10","-12"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-11 && test < 1.0e-10){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e11,5)+"  x  10","-11"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-10 && test < 1.0e-9){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e10,5)+"  x  10","-10"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-9 && test < 1.0e-8){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e9,5)+"  x  10","-9"," ",g,fonto,x,y);
	    }
	    
	    else if(test >= 1.0e-8 && test < 1.0e-7){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e8,5)+"  x  10","-8"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-7 && test < 1.0e-6){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e7,5)+"  x  10","-7"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-6 && test < 1.0e-5){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e6,5)+"  x  10","-6"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-5 && test < 1.0e-4){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e5,5)+"  x  10","-5"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-4 && test < 1.0e-3){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e4,5)+"  x  10","-4"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-3 && test < 1.0e-2){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e3,5)+"  x  10","-3"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-2 && test < 1.0e-1){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e2,5)+"  x  10","-2"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-1 && test < 1.0){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e1,5)+"  x  10","-1"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0 && test < 1.0e1){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test,5)+"  ",""," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e1 && test < 1.0e2){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test,5)+"  ",""," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e2 && test < 1.0e3){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-2,5)+"  x  10","2"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e3 && test < 1.0e4){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-3,5)+"  x  10","3"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e4 && test < 1.0e5){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-4,5)+"  x  10","4"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e5 && test < 1.0e6){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-5,5)+"  x  10","5"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e6 && test < 1.0e7){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-6,5)+"  x  10","6"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e7 && test < 1.0e8){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-7,5)+"  x  10","7"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e8 && test < 1.0e9){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-8,5)+"  x  10","8"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e9 && test < 1.0e10){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-9,5)+"  x  10","9"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e10 && test < 1.0e11){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-10,5)+"  x  10","10"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e11 && test < 1.0e12){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-11,5)+"  x  10","11"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e12 && test < 1.0e13){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-12,5)+"  x  10","12"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e13 && test < 1.0e14){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-13,5)+"  x  10","13"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e14 && test < 1.0e15){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-14,5)+"  x  10","14"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e15 && test < 1.0e16){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-15,5)+"  x  10","15"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e16 && test < 1.0e17){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-16,5)+"  x  10","16"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e17 && test < 1.0e18){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-17,5)+"  x  10","17"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e18 && test < 1.0e19){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-18,5)+"  x  10","18"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e19 && test < 1.0e20){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-19,5)+"  x  10","19"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e20 && test < 1.0e21){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-20,5)+"  x  10","20"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e21){
		MaestroG.superscripter("  =  "+test+"",""," ",g,fonto,x,y);
	    }
            
            //g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_OFF);
        }

        public void WriteC(Graphics g, double test, int fonto, int x, int y){
            Graphics2D g2d = (Graphics2D)g;
            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
        
            
            //if(test < 1.0e-15){
		//MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e16,5)+"  x  10","-16"," ",g,fonto,x,y);
	    //}
            if(test < 1.0e-15){
		MaestroG.superscripter("  =  0.0",""," ",g,fonto,x,y);
	    }
            else if(test >= 1.0e-15 && test < 1.0e-14){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e15,5)+"  x  10","-15"," ",g,fonto,x,y);
	    }
            else if(test >= 1.0e-14 && test < 1.0e-13){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e14,5)+"  x  10","-14"," ",g,fonto,x,y);
	    }
            else if(test >= 1.0e-13 && test < 1.0e-12){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e13,5)+"  x  10","-13"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-12 && test < 1.0e-11){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e12,5)+"  x  10","-12"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-11 && test < 1.0e-10){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e11,5)+"  x  10","-11"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-10 && test < 1.0e-9){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e10,5)+"  x  10","-10"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-9 && test < 1.0e-8){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e9,5)+"  x  10","-9"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-8 && test < 1.0e-7){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e8,5)+"  x  10","-8"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-7 && test < 1.0e-6){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e7,5)+"  x  10","-7"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-6 && test < 1.0e-5){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e6,5)+"  x  10","-6"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-5 && test < 1.0e-4){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e5,5)+"  x  10","-5"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-4 && test < 1.0e-3){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e4,5)+"  x  10","-4"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-3 && test < 1.0e-2){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e3,5)+"  x  10","-3"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-2 && test < 1.0e-1){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e2,5)+"  x  10","-2"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-1 && test < 1.0){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e1,5)+"  x  10","-1"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0 && test < 1.0e1){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test,5)+"  ",""," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e1 && test < 1.0e2){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test,5)+"  ",""," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e2 && test < 1.0e3){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-2,5)+"  x  10","2"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e3 && test < 1.0e4){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-3,5)+"  x  10","3"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e4 && test < 1.0e5){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-4,5)+"  x  10","4"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e5 && test < 1.0e6){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-5,5)+"  x  10","5"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e6 && test < 1.0e7){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-6,5)+"  x  10","6"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e7 && test < 1.0e8){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-7,5)+"  x  10","7"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e8 && test < 1.0e9){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-8,5)+"  x  10","8"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e9 && test < 1.0e10){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-9,5)+"  x  10","9"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e10 && test < 1.0e11){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-10,5)+"  x  10","10"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e11 && test < 1.0e12){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-11,5)+"  x  10","11"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e12 && test < 1.0e13){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-12,5)+"  x  10","12"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e13 && test < 1.0e14){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-13,5)+"  x  10","13"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e14 && test < 1.0e15){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-14,5)+"  x  10","14"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e15 && test < 1.0e16){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-15,5)+"  x  10","15"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e16 && test < 1.0e17){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-16,5)+"  x  10","16"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e17 && test < 1.0e18){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-17,5)+"  x  10","17"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e18 && test < 1.0e19){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-18,5)+"  x  10","18"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e19 && test < 1.0e20){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-19,5)+"  x  10","19"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e20 && test < 1.0e21){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-20,5)+"  x  10","20"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e21){
		MaestroG.superscripter("  =  - j "+test+"",""," ",g,fonto,x,y);
	    }
            
            //g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_OFF);
        }
}

class ObliqueOutputCanvasF extends Canvas{
	
	private static final Font normalfont = new Font("Sanserif",Font.PLAIN,11);
        private static final Font normalfont2 = 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);
	private static final Font symbfont = new Font("Serif",Font.PLAIN,13);
	Oblique_State state;
	private Image im;
	private Graphics buf;
        
        public static int prec1 = 6;
        public static int prec2 = 6;

	public ObliqueOutputCanvasF(Oblique_State state){
	    super();
	    this.state = state;
	}
	public void paint(Graphics g){
	    if(im == null){
		im = createImage(getSize().width,getSize().height);
		buf = im.getGraphics();
		drawGraph(buf);
	    }
	    else{
		drawGraph(buf);
	    }
	    g.drawImage(im,0,0,null);
	}

	//Addition to reduce flicker new routine
	public void update(Graphics g){		// added to avoid clearing
	    paint(g);
	}

	public void drawGraph(Graphics g){
	    int x, x2, x3, x4, y, dx, dxx, dy, dyy;
	    Complex temp1, temp2;
	    double temp3, temp4, temp5, ratioZ, test1, test2, test3, factor1;
	    FontMetrics fm;
	    x = 5;
            x3 = 10;
            x4 = 35;
            x2 = 230;
	    y = 18;
	    dx = 80;
	    dxx = 15;
	    g.clearRect(0,0,getSize().width,getSize().height);
	    int fonto = 12;
	    g.setFont(titlefont);
            g.setColor(Color.blue.darker());
	    
	    g.setFont(normalfont2);
	    fm = g.getFontMetrics();
	    dy = 20;//fm.getHeight()-1;
	    dyy = dy+4;
	    
            double radiusH = 6;
            double xpos = x+10;
            double ypos2 = y+dy;
            double xpos2 = x+10;
            double ypos = y;
	    
	    if(state.isPolarizationParallel){
                
                g.setFont(normalfont);
                fm = g.getFontMetrics();
                
                double R1, R2;
                Complex R3;
                R1 = MaestroA.rounder(Complex.Real(state.Reflection_CoefH),6);
                R2 = MaestroA.rounder(Complex.Imaginary(state.Reflection_CoefH),6);
                R3 = new Complex(R1,R2);
                    
                double T1, T2;
                Complex T3;
                T1 = MaestroA.rounder(Complex.Real(state.Transmission_CoefH),6);
                T2 = MaestroA.rounder(Complex.Imaginary(state.Transmission_CoefH),6);
                T3 = new Complex(T1,T2);
                
                double RE1, RE2;
                Complex RE3;
                RE1 = MaestroA.rounder(Complex.Real(state.Reflection_Coef),6);
                RE2 = MaestroA.rounder(Complex.Imaginary(state.Reflection_Coef),6);
                RE3 = new Complex(RE1,RE2);
                    
                double TE1, TE2;
                Complex TE3;
                TE1 = MaestroA.rounder(Complex.Real(state.Transmission_Coef),6);
                TE2 = MaestroA.rounder(Complex.Imaginary(state.Transmission_Coef),6);
                TE3 = new Complex(TE1,TE2);
                
                Graphics2D g2d = (Graphics2D)g;
                g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
            
                if(state.IsVectorIn){
                    
                    g.setColor(Color.magenta.darker());
                    
                    //MaestroG.subsubsubsubsub("","\u03b5","1","E","z"," = "+MaestroA.rounder(state.epsilon_r1*Complex.Real(state.wave_impedance1)*Math.sin(state.theta1),prec2)+" \u03b5","0","H","0"," \u00e2","z"," [ C/m\u00b2 ]", g,fonto,x3,y);
                    MaestroG.supsubsubsubsub2("","\u03b5","1","E","i","//","z"," = "+MaestroA.rounder(state.epsilon_r1*Complex.Real(state.wave_impedance1)*Math.sin(state.theta1),prec2)+" \u03b5","0","H","0"," z","^"," [ C/m\u00b2 ]", g,fonto,x3,y);
                    y+= dyy;
                   
                   if(state.theta1 < (state.totalR_angle*Math.PI/180.0)){
                        
                        //MaestroG.subsubsubsubsub("","\u03b5","1","E","zR"," = "+MaestroA.rounder(Complex.Real(state.wave_impedance1)*
                          //                                    Math.sin(state.theta1)*state.epsilon_r1*
                            //                                  MaestroA.rounder(R1,6),prec2)+" \u03b5","0","H","0"," \u00e2","z"," [ C/m\u00b2 ]",g,fonto,x3,y);
                        
                        MaestroG.supsubsubsubsub2("","\u03b5","1","E","r","//","z"," = "+MaestroA.rounder(Complex.Real(state.wave_impedance1)*
                                                              Math.sin(state.theta1)*state.epsilon_r1*
                                                              MaestroA.rounder(R1,6),prec2)+" \u03b5","0","H","0"," z","^"," [ C/m\u00b2 ]",g,fonto,x3,y);
                    }
                    else{
                        
                        String tmpx, tmpz;
                        Complex Ctempx, Ctempz;
                        
                        Ctempz = Complex.Multiply(Complex.Multiply(Math.cos(state.theta1),RE3),state.wave_impedance1);
                        Ctempx = Complex.Multiply(Complex.Multiply(Math.sin(state.theta1),RE3),state.wave_impedance1);
                        
                        if(Ctempx.Imaginary()>=0.0){
                            tmpx = String.valueOf(MaestroA.rounder((-1.0)*state.epsilon_r1*Ctempx.Real(),prec2))+" - j "+String.valueOf(MaestroA.rounder(Math.abs(state.epsilon_r1*Ctempx.Imaginary()),prec2));
                        }
                        else {
                            tmpx = String.valueOf(MaestroA.rounder((-1.0)*state.epsilon_r1*Ctempx.Real(),prec2))+" + j "+String.valueOf(MaestroA.rounder(Math.abs(state.epsilon_r1*Ctempx.Imaginary()),prec2));
                        }
                        
                        //MaestroG.subsubsubsubsub("","\u03b5","1","E","zR"," = ( "+tmpx+" ) \u03b5","0","H","0"," \u00e2","z"," [ C/m\u00b2 ]",g,fonto,x3,y); 
                        MaestroG.supsubsubsubsub2("","\u03b5","1","E","r","//","z"," = ( "+tmpx+" ) \u03b5","0","H","0"," z","^"," [ C/m\u00b2 ]",g,fonto,x3,y); 
                    }
                    
                    y+= dyy;
                        
                    if(state.theta1 < (state.totalR_angle*Math.PI/180.0)){
                        //MaestroG.subsubsubsubsub("","\u03b5","2","E","zT"," = "+MaestroA.rounder(state.epsilon_r2*Complex.Real(state.wave_impedance2)*
                          //                                    Math.sin(state.theta2)*MaestroA.rounder(T1,6),prec2)+" \u03b5","0","H","0"," \u00e2","z"," [ C/m\u00b2 ]",g,fonto,x3,y);
                        MaestroG.supsubsubsubsub2("","\u03b5","2","E","t","//","z"," = "+MaestroA.rounder(state.epsilon_r2*Complex.Real(state.wave_impedance2)*
                                                              Math.sin(state.theta2)*MaestroA.rounder(T1,6),prec2)+" \u03b5","0","H","0"," z","^"," [ C/m\u00b2 ]",g,fonto,x3,y);
                    }
                    else{
                        
                        String tmpx, tmpz;
                        Complex Ctempx, Ctempz, CtempTot;
                        Ctempz = Complex.Add(MaestroA.rounder(Complex.Real(state.wave_impedance1)*Math.cos(state.theta1),6),
                                                  Complex.Multiply(Complex.Multiply(Math.cos(state.theta1),RE3),state.wave_impedance1)
                                                 );
                        
                        Ctempz = Complex.Multiply(-1.0,Ctempz);
                        
                        Ctempx = Complex.Multiply(Complex.Subtract(MaestroA.rounder(Complex.Real(state.wave_impedance1)*Math.sin(state.theta1),6),
                                                  Complex.Multiply(Complex.Multiply(Math.sin(state.theta1),RE3),state.wave_impedance1)
                                                 ), state.epsilon_r1/state.epsilon_r2);
                        
                        CtempTot = Complex.Add(Ctempx,Ctempz);
                        
                        if(Ctempx.Imaginary()>=0.0){
                            tmpx = String.valueOf(MaestroA.rounder(state.epsilon_r2*Ctempx.Real(),prec2))+" + j "+String.valueOf(MaestroA.rounder(Math.abs(state.epsilon_r2*Ctempx.Imaginary()),prec2));
                        }
                        else {
                            tmpx = String.valueOf(MaestroA.rounder(state.epsilon_r2*Ctempx.Real(),prec2))+" - j "+String.valueOf(MaestroA.rounder(Math.abs(state.epsilon_r2*Ctempx.Imaginary()),prec2));
                        }
                        //MaestroG.subsubsubsubsub("","\u03b5","2","E","zT"," = ( "+tmpx+" ) \u03b5","0","H","0"," \u00e2","z"," [ C/m\u00b2 ]",g,fonto,x3,y);
                        MaestroG.supsubsubsubsub2("","\u03b5","2","E","t","//","z"," = ( "+tmpx+" ) \u03b5","0","H","0"," z","^"," [ C/m\u00b2 ]",g,fonto,x3,y);
                    }
                    
                }
                else{// flip incident direction
                    
                    g.setColor(Color.magenta.darker());
                    //MaestroG.subsubsubsubsub("","\u03b5","1","E","z"," = "+MaestroA.rounder((-1.0)*state.epsilon_r1*Complex.Real(state.wave_impedance1)*Math.sin(state.theta1),prec2)+" \u03b5","0","H","0"," \u00e2","z"," [ C/m\u00b2 ]",g,fonto,x3,y);
                    MaestroG.supsubsubsubsub2("","\u03b5","1","E","i","//","z"," = "+MaestroA.rounder((-1.0)*state.epsilon_r1*Complex.Real(state.wave_impedance1)*Math.sin(state.theta1),prec2)+" \u03b5","0","H","0"," z","^"," [ C/m\u00b2 ]",g,fonto,x3,y);
                    y+= dyy;
                    
                    if(state.theta1 < (state.totalR_angle*Math.PI/180.0)){
                        
                        //MaestroG.subsubsubsubsub("","\u03b5","1","E","zR"," = "+MaestroA.rounder((-1.0)*Complex.Real(state.wave_impedance1)*
                          //                                    Math.sin(state.theta1)*state.epsilon_r1*
                            //                                  MaestroA.rounder(R1,6),prec2)+" \u03b5","0","H","0"," \u00e2","z"," [ C/m\u00b2 ]",g,fonto,x3,y);
                        MaestroG.supsubsubsubsub2("","\u03b5","1","E","r","//","z"," = "+MaestroA.rounder((-1.0)*Complex.Real(state.wave_impedance1)*
                                                              Math.sin(state.theta1)*state.epsilon_r1*
                                                              MaestroA.rounder(R1,6),prec2)+" \u03b5","0","H","0"," z","^"," [ C/m\u00b2 ]",g,fonto,x3,y);
                    }
                    else{
                        
                        String tmpx, tmpz;
                        Complex Ctempx, Ctempz;
                        Ctempz = Complex.Multiply(Complex.Multiply(Math.cos(state.theta1),RE3),state.wave_impedance1);
                        Ctempx = Complex.Multiply(Complex.Multiply(Math.sin(state.theta1),RE3),state.wave_impedance1);
                        
                        if(Ctempx.Imaginary()>=0.0){
                            tmpx = String.valueOf(MaestroA.rounder(state.epsilon_r1*Ctempx.Real(),prec2))+" + j "+String.valueOf(MaestroA.rounder(Math.abs(state.epsilon_r1*Ctempx.Imaginary()),prec2));
                        }
                        else {
                            tmpx = String.valueOf(MaestroA.rounder(state.epsilon_r1*Ctempx.Real(),prec2))+" - j "+String.valueOf(MaestroA.rounder(Math.abs(state.epsilon_r1*Ctempx.Imaginary()),prec2));
                        }
                        
                        //MaestroG.subsubsubsubsub("","\u03b5","1","E","zR"," = ( "+tmpx+" ) \u03b5","0","H","0"," \u00e2","z"," [ C/m\u00b2 ]",g,fonto,x3,y); 
                        MaestroG.supsubsubsubsub2("","\u03b5","1","E","r","//","z"," = ( "+tmpx+" ) \u03b5","0","H","0"," z","^"," [ C/m\u00b2 ]",g,fonto,x3,y); 
                    }
                    
                    y+= dyy;
                    
                    if(state.theta1 < (state.totalR_angle*Math.PI/180.0)){
                        //MaestroG.subsubsubsubsub("","\u03b5","2","E","zT"," = "+MaestroA.rounder((-1.0)*state.epsilon_r2*Complex.Real(state.wave_impedance2)*
                          //                                    Math.sin(state.theta2)*MaestroA.rounder(T1,6),prec2)+" \u03b5","0","H","0"," \u00e2","z"," [ C/m\u00b2 ]",g,fonto,x3,y);
                        MaestroG.supsubsubsubsub2("","\u03b5","2","E","t","//","z"," = "+MaestroA.rounder((-1.0)*state.epsilon_r2*Complex.Real(state.wave_impedance2)*
                                                              Math.sin(state.theta2)*MaestroA.rounder(T1,6),prec2)+" \u03b5","0","H","0"," z","^"," [ C/m\u00b2 ]",g,fonto,x3,y);
                    }
                    else{
                        String tmpx, tmpz;
                        Complex Ctempx, Ctempz, CtempTot;
                        Ctempz = Complex.Add(MaestroA.rounder(Complex.Real(state.wave_impedance1)*Math.cos(state.theta1),6),
                                                  Complex.Multiply(Complex.Multiply(Math.cos(state.theta1),RE3),state.wave_impedance1)
                                                 );
                        
                        Ctempx = Complex.Multiply(Complex.Subtract(MaestroA.rounder(Complex.Real(state.wave_impedance1)*Math.sin(state.theta1),6),
                                                  Complex.Multiply(Complex.Multiply(Math.sin(state.theta1),RE3),state.wave_impedance1)
                                                 ), state.epsilon_r1/state.epsilon_r2);
                        
                        Ctempx = Complex.Multiply(-1.0,Ctempx);
                        
                        CtempTot = Complex.Add(Ctempx,Ctempz);
                        
                        if(Ctempx.Imaginary()>=0.0){
                            tmpx = String.valueOf(MaestroA.rounder(state.epsilon_r2*Ctempx.Real(),prec2))+" + j "+String.valueOf(MaestroA.rounder(Math.abs(state.epsilon_r2*Ctempx.Imaginary()),prec2));
                        }
                        else {
                            tmpx = String.valueOf(MaestroA.rounder(state.epsilon_r2*Ctempx.Real(),prec2))+" - j "+String.valueOf(MaestroA.rounder(Math.abs(state.epsilon_r2*Ctempx.Imaginary()),prec2));
                        }
                        //MaestroG.subsubsubsubsub("","\u03b5","2","E","zT"," = ( "+tmpx+" ) \u03b5","0","H","0"," \u00e2","z"," [ C/m\u00b2 ]",g,fonto,x3,y);
                        MaestroG.supsubsubsubsub2("","\u03b5","2","E","t","//","z"," = ( "+tmpx+" ) \u03b5","0","H","0"," z","^"," [ C/m\u00b2 ]",g,fonto,x3,y);
                    }
                    
                }
            }
            else{
                g.setFont(normalfont);
                fm = g.getFontMetrics();
                
                double R1, R2;
                Complex R3;
                R1 = MaestroA.rounder(Complex.Real(state.Reflection_Coef),6);
                R2 = MaestroA.rounder(Complex.Imaginary(state.Reflection_Coef),6);
                R3 = new Complex(R1,R2);
                    
                double T1, T2;
                Complex T3;
                T1 = MaestroA.rounder(Complex.Real(state.Transmission_Coef),6);
                T2 = MaestroA.rounder(Complex.Imaginary(state.Transmission_Coef),6);
                T3 = new Complex(T1,T2);
                
                double RE1, RE2;
                Complex RE3;
                RE1 = MaestroA.rounder(Complex.Real(state.Reflection_CoefH),6);
                RE2 = MaestroA.rounder(Complex.Imaginary(state.Reflection_CoefH),6);
                RE3 = new Complex(RE1,RE2);
                    
                double TE1, TE2;
                Complex TE3;
                TE1 = MaestroA.rounder(Complex.Real(state.Transmission_CoefH),6);
                TE2 = MaestroA.rounder(Complex.Imaginary(state.Transmission_CoefH),6);
                TE3 = new Complex(TE1,TE2);
                
                if(state.IsVectorIn){
                    
                    g.setColor(Color.blue);
                    //MaestroG.subsubsubsubsub("","\u03bc","1","H","z"," = "+MaestroA.rounder((-1.0)*state.mu_r1/Complex.Real(state.wave_impedance1)*Math.sin(state.theta1),prec2)+" \u03bc","0","E","0"," \u00e2","z","  [ T ]",g,fonto,x3,y);
                    MaestroG.supsubsubsubsub2("","\u03bc","1","H","i","","\u22a5z"," = "+MaestroA.rounder((-1.0)*state.mu_r1/Complex.Real(state.wave_impedance1)*Math.sin(state.theta1),prec2)+" \u03bc","0","E","0"," z","^","  [ T ]",g,fonto,x3,y);
                    y+= dyy;
                    
                    if(state.theta1 < (state.totalR_angle*Math.PI/180.0)){
                        
                        //MaestroG.subsubsubsubsub("","\u03bc","1","H","zR"," = "+MaestroA.rounder((-1.0)*state.mu_r1/Complex.Real(state.wave_impedance1)*
                          //                                    Math.sin(state.theta1)*MaestroA.rounder(R1,6),prec2)+" \u03bc","0","E","0"," \u00e2","z","  [ T ]",g,fonto,x3,y);
                        MaestroG.supsubsubsubsub2("","\u03bc","1","H","r","","\u22a5z"," = "+MaestroA.rounder((-1.0)*state.mu_r1/Complex.Real(state.wave_impedance1)*
                                                              Math.sin(state.theta1)*MaestroA.rounder(R1,6),prec2)+" \u03bc","0","E","0"," z","^","  [ T ]",g,fonto,x3,y);
                        
                    }
                    else{
                        String tmpx, tmpz;
                        Complex Ctempx, Ctempz;
                        Ctempz = Complex.Divide(Complex.Multiply(Math.cos(state.theta1),RE3),state.wave_impedance1);
                        Ctempx = Complex.Divide(Complex.Multiply(Math.sin(state.theta1),RE3),state.wave_impedance1);
                        
                        if(Ctempx.Imaginary()>=0.0){
                            tmpx = String.valueOf(MaestroA.rounder(state.mu_r1*Ctempx.Real(),prec2))+" + j "+String.valueOf(MaestroA.rounder(state.mu_r1*Math.abs(Ctempx.Imaginary()),prec2));
                        }
                        else {
                            tmpx = String.valueOf(MaestroA.rounder(state.mu_r1*Ctempx.Real(),prec2))+" - j "+String.valueOf(MaestroA.rounder(state.mu_r1*Math.abs(Ctempx.Imaginary()),prec2));
                        }
                        
                        //MaestroG.subsubsubsubsub("","\u03bc","1","H","zR"," = ( "+tmpx+" ) \u03bc","0","E","0"," \u00e2","z","  [ T ]",g,fonto,x3,y); 
                        MaestroG.supsubsubsubsub2("","\u03bc","1","H","r","","\u22a5z"," = ( "+tmpx+" ) \u03bc","0","E","0"," z","^","  [ T ]",g,fonto,x3,y); 
                    }
                    
                    y+= dyy;
                    
                    if(state.theta1 < (state.totalR_angle*Math.PI/180.0)){
                        //MaestroG.subsubsubsubsub("","\u03bc","2","H","zT"," = "+MaestroA.rounder((-1.0)/Complex.Real(state.wave_impedance2)*
                          //                                    Math.sin(state.theta2)*MaestroA.rounder(T1,6),prec2)+" \u03bc","0","E","0"," \u00e2","z","  [ T ]",g,fonto,x3,y);
                        MaestroG.supsubsubsubsub2("","\u03bc","2","H","t","","\u22a5z"," = "+MaestroA.rounder((-1.0)/Complex.Real(state.wave_impedance2)*
                                                              Math.sin(state.theta2)*MaestroA.rounder(T1,6),prec2)+" \u03bc","0","E","0"," z","^","  [ T ]",g,fonto,x3,y);
                        
                    }
                    else{
                        
                        String tmpx, tmpz;
                        Complex Ctempx, Ctempz, CtempTot;
                        Ctempz = Complex.Add(MaestroA.rounder(Math.cos(state.theta1)/Complex.Real(state.wave_impedance1),6),
                                                  Complex.Divide(Complex.Multiply(Math.cos(state.theta1),RE3),state.wave_impedance1)
                                                 );
                                 
                        Ctempx = Complex.Multiply(Complex.Subtract(MaestroA.rounder(Math.sin(state.theta1)/Complex.Real(state.wave_impedance1),6),
                                                  Complex.Divide(Complex.Multiply(Math.sin(state.theta1),RE3),state.wave_impedance1)
                                                 ), state.mu_r1/state.mu_r2);
                        Ctempx = Complex.Multiply(-1.0,Ctempx);
                        
                        CtempTot = Complex.Add(Ctempx,Ctempz);
                        
                        if(Ctempx.Imaginary()>=0.0){
                            tmpx = String.valueOf(MaestroA.rounder(state.mu_r2*Ctempx.Real(),prec2))+" + j "+String.valueOf(state.mu_r2*MaestroA.rounder(Math.abs(Ctempx.Imaginary()),prec2));
                        }
                        else {
                            tmpx = String.valueOf(MaestroA.rounder(state.mu_r2*Ctempx.Real(),prec2))+" - j "+String.valueOf(MaestroA.rounder(state.mu_r2*Math.abs(Ctempx.Imaginary()),prec2));
                        }
                        //MaestroG.subsubsubsubsub("","\u03bc","2","H","zT"," = ( "+tmpx+" ) \u03bc","0","E","0"," \u00e2","z","  [ T ]",g,fonto,x3,y);
                        MaestroG.supsubsubsubsub2("","\u03bc","2","H","t","","\u22a5z"," = ( "+tmpx+" ) \u03bc","0","E","0"," z","^","  [ T ]",g,fonto,x3,y);
                    }
                    
                }
                else{// flip incident direction
                    
                    g.setColor(Color.blue);
                    //MaestroG.subsubsubsubsub("","\u03bc","1","H","z"," = "+MaestroA.rounder((1.0)*state.mu_r1/Complex.Real(state.wave_impedance1)*Math.sin(state.theta1),prec2)+" \u03bc","0","E","0"," \u00e2","z","  [ T ]",g,fonto,x3,y);
                    MaestroG.supsubsubsubsub2("","\u03bc","1","H","i","","\u22a5z"," = "+MaestroA.rounder((1.0)*state.mu_r1/Complex.Real(state.wave_impedance1)*Math.sin(state.theta1),prec2)+" \u03bc","0","E","0"," z","^","  [ T ]",g,fonto,x3,y);
                    y+= dyy;
                        
                    if(state.theta1 < (state.totalR_angle*Math.PI/180.0)){
                        
                        //MaestroG.subsubsubsubsub("","\u03bc","1","H","zR"," = "+MaestroA.rounder((1.0)*state.mu_r1/Complex.Real(state.wave_impedance1)*
                          //                                    Math.sin(state.theta1)*MaestroA.rounder(R1,6),prec2)+" \u03bc","0","E","0"," \u00e2","z","  [ T ]",g,fonto,x3,y);
                        MaestroG.supsubsubsubsub2("","\u03bc","1","H","r","","\u22a5z"," = "+MaestroA.rounder((1.0)*state.mu_r1/Complex.Real(state.wave_impedance1)*
                                                              Math.sin(state.theta1)*MaestroA.rounder(R1,6),prec2)+" \u03bc","0","E","0"," z","^","  [ T ]",g,fonto,x3,y);
                        
                    }
                    else{
                        String tmpx, tmpz;
                        Complex Ctempx, Ctempz;
                        Ctempz = Complex.Divide(Complex.Multiply(Math.cos(state.theta1),RE3),state.wave_impedance1);
                        Ctempx = Complex.Divide(Complex.Multiply(Math.sin(state.theta1),RE3),state.wave_impedance1);
                        
                        if(Ctempx.Imaginary()>=0.0){
                            tmpx = String.valueOf(MaestroA.rounder((-1.0)*state.mu_r1*Ctempx.Real(),prec2))+" - j "+String.valueOf(MaestroA.rounder(Math.abs(state.mu_r1*Ctempx.Imaginary()),prec2));
                        }
                        else {
                            tmpx = String.valueOf(MaestroA.rounder((-1.0)*state.mu_r1*Ctempx.Real(),prec2))+" + j "+String.valueOf(MaestroA.rounder(Math.abs(state.mu_r1*Ctempx.Imaginary()),prec2));
                        }
                        
                        //MaestroG.subsubsubsubsub("","\u03bc","1","H","zR"," = ( "+tmpx+" ) \u03bc","0","E","0"," \u00e2","z","  [ T ]",g,fonto,x3,y); 
                        MaestroG.supsubsubsubsub2("","\u03bc","1","H","r","","\u22a5z"," = ( "+tmpx+" ) \u03bc","0","E","0"," z","^","  [ T ]",g,fonto,x3,y); 
                    }
                    
                    y+= dyy;
                    
                    if(state.theta1 < (state.totalR_angle*Math.PI/180.0)){
                        //MaestroG.subsubsubsubsub("","\u03bc","2","H","zT"," = "+MaestroA.rounder((1.0)/Complex.Real(state.wave_impedance2)*
                          //                                    Math.sin(state.theta2)*MaestroA.rounder(T1,6),prec2)+" \u03bc","0","E","0"," \u00e2","z","  [ T ]",g,fonto,x3,y);
                        MaestroG.supsubsubsubsub2("","\u03bc","2","H","t","","\u22a5z"," = "+MaestroA.rounder((1.0)/Complex.Real(state.wave_impedance2)*
                                                              Math.sin(state.theta2)*MaestroA.rounder(T1,6),prec2)+" \u03bc","0","E","0"," z","^","  [ T ]",g,fonto,x3,y);
                        
                    }
                    else{
                        
                        String tmpx, tmpz;
                        Complex Ctempx, Ctempz, CtempTot;
                        Ctempz = Complex.Add(MaestroA.rounder(Math.cos(state.theta1)/Complex.Real(state.wave_impedance1),6),
                                                  Complex.Divide(Complex.Multiply(Math.cos(state.theta1),RE3),state.wave_impedance1)
                                                 );
                        
                        Ctempz = Complex.Multiply(-1.0,Ctempz);
                                 
                        Ctempx = Complex.Multiply(Complex.Subtract(MaestroA.rounder(Math.sin(state.theta1)/Complex.Real(state.wave_impedance1),6),
                                                  Complex.Divide(Complex.Multiply(Math.sin(state.theta1),RE3),state.wave_impedance1)
                                                 ), state.mu_r1/state.mu_r2);
                        
                         CtempTot = Complex.Add(Ctempx,Ctempz);
                        
                        if(Ctempx.Imaginary()>=0.0){
                            tmpx = String.valueOf(MaestroA.rounder(state.mu_r2*Ctempx.Real(),prec2))+" + j "+String.valueOf(MaestroA.rounder(Math.abs(state.mu_r2*Ctempx.Imaginary()),prec2));
                        }
                        else {
                            tmpx = String.valueOf(MaestroA.rounder(state.mu_r2*Ctempx.Real(),prec2))+" - j "+String.valueOf(MaestroA.rounder(Math.abs(state.mu_r2*Ctempx.Imaginary()),prec2));
                        }
                        
                        //MaestroG.subsubsubsubsub("","\u03bc","2","H","zT"," = ( "+tmpx+" ) \u03bc","0","E","0"," \u00e2","z","  [ T ]",g,fonto,x3,y);
                        MaestroG.supsubsubsubsub2("","\u03bc","2","H","t","","\u22a5z"," = ( "+tmpx+" ) \u03bc","0","E","0"," z","^","  [ T ]",g,fonto,x3,y);
                    }  
                }
            }
	}
        
        public void Write(Graphics g, double test, int fonto, int x, int y){
            Graphics2D g2d = (Graphics2D)g;
            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
        
            
            //if(test < 1.0e-15){
		//MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e16,5)+"  x  10","-16"," ",g,fonto,x,y);
	    //}
            if(test < 1.0e-15){
		MaestroG.superscripter("  =  0.0",""," ",g,fonto,x,y);
	    }
            else if(test >= 1.0e-15 && test < 1.0e-14){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e15,5)+"  x  10","-15"," ",g,fonto,x,y);
	    }
            else if(test >= 1.0e-14 && test < 1.0e-13){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e14,5)+"  x  10","-14"," ",g,fonto,x,y);
	    }
            else if(test >= 1.0e-13 && test < 1.0e-12){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e13,5)+"  x  10","-13"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-12 && test < 1.0e-11){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e12,5)+"  x  10","-12"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-11 && test < 1.0e-10){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e11,5)+"  x  10","-11"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-10 && test < 1.0e-9){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e10,5)+"  x  10","-10"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-9 && test < 1.0e-8){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e9,5)+"  x  10","-9"," ",g,fonto,x,y);
	    }
	    
	    else if(test >= 1.0e-8 && test < 1.0e-7){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e8,5)+"  x  10","-8"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-7 && test < 1.0e-6){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e7,5)+"  x  10","-7"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-6 && test < 1.0e-5){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e6,5)+"  x  10","-6"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-5 && test < 1.0e-4){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e5,5)+"  x  10","-5"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-4 && test < 1.0e-3){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e4,5)+"  x  10","-4"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-3 && test < 1.0e-2){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e3,5)+"  x  10","-3"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-2 && test < 1.0e-1){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e2,5)+"  x  10","-2"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-1 && test < 1.0){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e1,5)+"  x  10","-1"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0 && test < 1.0e1){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test,5)+"  ",""," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e1 && test < 1.0e2){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test,5)+"  ",""," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e2 && test < 1.0e3){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-2,5)+"  x  10","2"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e3 && test < 1.0e4){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-3,5)+"  x  10","3"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e4 && test < 1.0e5){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-4,5)+"  x  10","4"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e5 && test < 1.0e6){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-5,5)+"  x  10","5"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e6 && test < 1.0e7){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-6,5)+"  x  10","6"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e7 && test < 1.0e8){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-7,5)+"  x  10","7"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e8 && test < 1.0e9){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-8,5)+"  x  10","8"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e9 && test < 1.0e10){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-9,5)+"  x  10","9"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e10 && test < 1.0e11){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-10,5)+"  x  10","10"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e11 && test < 1.0e12){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-11,5)+"  x  10","11"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e12 && test < 1.0e13){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-12,5)+"  x  10","12"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e13 && test < 1.0e14){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-13,5)+"  x  10","13"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e14 && test < 1.0e15){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-14,5)+"  x  10","14"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e15 && test < 1.0e16){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-15,5)+"  x  10","15"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e16 && test < 1.0e17){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-16,5)+"  x  10","16"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e17 && test < 1.0e18){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-17,5)+"  x  10","17"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e18 && test < 1.0e19){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-18,5)+"  x  10","18"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e19 && test < 1.0e20){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-19,5)+"  x  10","19"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e20 && test < 1.0e21){
		MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e-20,5)+"  x  10","20"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e21){
		MaestroG.superscripter("  =  "+test+"",""," ",g,fonto,x,y);
	    }
            
            //g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_OFF);
        }

        public void WriteC(Graphics g, double test, int fonto, int x, int y){
            Graphics2D g2d = (Graphics2D)g;
            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
        
            
            //if(test < 1.0e-15){
		//MaestroG.superscripter("  =  "+MaestroA.rounder(test*1.0e16,5)+"  x  10","-16"," ",g,fonto,x,y);
	    //}
            if(test < 1.0e-15){
		MaestroG.superscripter("  =  0.0",""," ",g,fonto,x,y);
	    }
            else if(test >= 1.0e-15 && test < 1.0e-14){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e15,5)+"  x  10","-15"," ",g,fonto,x,y);
	    }
            else if(test >= 1.0e-14 && test < 1.0e-13){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e14,5)+"  x  10","-14"," ",g,fonto,x,y);
	    }
            else if(test >= 1.0e-13 && test < 1.0e-12){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e13,5)+"  x  10","-13"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-12 && test < 1.0e-11){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e12,5)+"  x  10","-12"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-11 && test < 1.0e-10){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e11,5)+"  x  10","-11"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-10 && test < 1.0e-9){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e10,5)+"  x  10","-10"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-9 && test < 1.0e-8){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e9,5)+"  x  10","-9"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-8 && test < 1.0e-7){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e8,5)+"  x  10","-8"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-7 && test < 1.0e-6){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e7,5)+"  x  10","-7"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-6 && test < 1.0e-5){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e6,5)+"  x  10","-6"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-5 && test < 1.0e-4){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e5,5)+"  x  10","-5"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-4 && test < 1.0e-3){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e4,5)+"  x  10","-4"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-3 && test < 1.0e-2){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e3,5)+"  x  10","-3"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-2 && test < 1.0e-1){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e2,5)+"  x  10","-2"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e-1 && test < 1.0){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e1,5)+"  x  10","-1"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0 && test < 1.0e1){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test,5)+"  ",""," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e1 && test < 1.0e2){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test,5)+"  ",""," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e2 && test < 1.0e3){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-2,5)+"  x  10","2"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e3 && test < 1.0e4){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-3,5)+"  x  10","3"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e4 && test < 1.0e5){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-4,5)+"  x  10","4"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e5 && test < 1.0e6){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-5,5)+"  x  10","5"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e6 && test < 1.0e7){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-6,5)+"  x  10","6"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e7 && test < 1.0e8){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-7,5)+"  x  10","7"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e8 && test < 1.0e9){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-8,5)+"  x  10","8"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e9 && test < 1.0e10){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-9,5)+"  x  10","9"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e10 && test < 1.0e11){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-10,5)+"  x  10","10"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e11 && test < 1.0e12){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-11,5)+"  x  10","11"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e12 && test < 1.0e13){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-12,5)+"  x  10","12"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e13 && test < 1.0e14){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-13,5)+"  x  10","13"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e14 && test < 1.0e15){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-14,5)+"  x  10","14"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e15 && test < 1.0e16){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-15,5)+"  x  10","15"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e16 && test < 1.0e17){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-16,5)+"  x  10","16"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e17 && test < 1.0e18){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-17,5)+"  x  10","17"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e18 && test < 1.0e19){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-18,5)+"  x  10","18"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e19 && test < 1.0e20){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-19,5)+"  x  10","19"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e20 && test < 1.0e21){
		MaestroG.superscripter("  =  - j "+MaestroA.rounder(test*1.0e-20,5)+"  x  10","20"," ",g,fonto,x,y);
	    }
	    else if(test >= 1.0e21){
		MaestroG.superscripter("  =  - j "+test+"",""," ",g,fonto,x,y);
	    }
            
            //g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_OFF);
        }
}