//Trans_OutputPanel.java

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

public class Trans_OutputPanel extends Panel implements ItemListener{
    //private static final Color bgcolor = new Color(180,147,112);
    //private static final Color bgcolor = Color.lightGray;
    private static final Color bgcolor = new Color(236,236,236);
    
    private static final Font labfont=new Font("SanSerif",Font.PLAIN,12);
    private static final Font titlefont=new Font("SanSerif",Font.BOLD,16);
    private static final Font normalfont = new Font("SanSerif",Font.PLAIN,12);
    private static final Font symbolfont = new Font("Symbol",Font.PLAIN,12);
    private static final Font subfont    = new Font("SanSerif",Font.PLAIN,10);
    Label titlelabel;
    public Choice c1;
    public SpaceDependentCanvas canvas1;
    public SpaceIndependentCanvas canvas2;
    public StubOutputCanvas canvas3;
    Trans_State state;
    public Trans_OutputPanel(Trans_State state){
	super();
	this.state = state;
	titlelabel = new Label("Output Data",Label.LEFT);
	setLayout(null);
	add(titlelabel);
	titlelabel.setFont(titlefont);
    
	setBackground(bgcolor);
	
	c1 = new Choice();
	c1.addItem("     Propagation Data");
        c1.setFont(new Font("SanSerif",Font.PLAIN,11));
		
	//c1.addItem("     Transmission Line Data 2");
	c1.addItem("     Tansmission Line Summary");
	c1.setBackground(bgcolor.brighter());
	
	canvas1 = new SpaceDependentCanvas(state);
	canvas2 = new SpaceIndependentCanvas(state);
	canvas3 = new StubOutputCanvas(state);
	
	add(titlelabel);
	//add(c1);
	add(canvas1);
	//add(canvas2);
	//add(canvas3);
	
	titlelabel.setBounds(10,2,160,25);
        titlelabel.setForeground(Color.black);
        
	c1.setBounds(80,5,220,25);
	canvas1.setBounds(6,6,298,385);
	canvas2.setBounds(6,26,298,260);
	canvas3.setBounds(6,6,298,385);
	
	//Listeners
	c1.addItemListener(this);
    }
    
    public void itemStateChanged(ItemEvent evt){
	ItemSelectable ie = evt.getItemSelectable();
	    if(evt.getSource()==c1){
		if(ie.getSelectedObjects()[0]=="     Propagation Data"){
		    canvas1.setVisible(true);
		    canvas2.setVisible(false);
		    canvas3.setVisible(false);
		}
		else if(ie.getSelectedObjects()[0]=="     Transmission Line Data 2"){
		    canvas1.setVisible(false);
		    canvas2.setVisible(true);
		    canvas3.setVisible(false);
		}
		else if(ie.getSelectedObjects()[0]=="     Tansmission Line Summary"){
		    canvas1.setVisible(false);
		    canvas2.setVisible(false);
		    canvas3.setVisible(true);
		}
	    }
    }	
        
    public void paint(Graphics g){
	    g.clearRect(0,0,getSize().width,getSize().height);
	    g.setColor(bgcolor.darker());
	    g.fillRect(0,getSize().height-2,getSize().width,2);
	    g.fillRect(getSize().width-2,0,2,getSize().height);
	    g.setColor(bgcolor.brighter());
	    g.fillRect(0,0,2,getSize().height-1);
	    g.fillRect(0,0,getSize().width-2,2);
    }
}

class SpaceDependentCanvas extends Canvas{
	private static final Font normalfont = new Font("SanSerif",Font.PLAIN,11);
	private static final Font symbolfont = new Font("Symbol",Font.PLAIN,12);
	private static final Font subfont    = new Font("SanSerif",Font.PLAIN,10);
	Trans_State state;
	private Image im;
	private Graphics buf;
	public SpaceDependentCanvas(Trans_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){
	    double epsilon0 = 8.8541878176E-12; // Units: F/m
	    double mu0 = 1.25663706144E-6; //      Units H/m
	    double light_velocity = Math.sqrt(1.0/(epsilon0*mu0)); //  Units m/s
	    double tempR = 0.0; double tempX = 0.0;
            double temp;
            Complex tempc;
            
            int x, y, dx, dxx, dxxx, dy, dyy, stepx;
            boolean Gamma_plusone, Gamma_minusone;
            Font symbolfont=new Font("Symbol",Font.PLAIN,12);
            FontMetrics fm;
		
            g.setFont(new Font("Serif",Font.PLAIN,12));
		
		String alpha, Ohm, lambda, infinity, Gamma, plusj, minusj, 
                       sign, plusr, minusr, signr;
		g.setFont(symbolfont);
		alpha="\u03b1";
		lambda="\u03bb";
		Ohm="\u03a9";
		infinity="\u221e";
		Gamma="\u0393";
                g.setFont(normalfont);
		plusj =" + j ";
		minusj=" - j ";
                plusr ="";
                minusr =" - ";
                
            Gamma_plusone = false;
            Gamma_minusone = false;
	    //Complex tempc;
	    x = 10;
	    y = 40;
	    dx = 80;
	    dxx = 15;
            dxxx = 80;
	    
	    fm = g.getFontMetrics();
	    dy = fm.getHeight()+2;
	    dyy = dy + 8;
	    g.clearRect(0,0,getSize().width,getSize().height);
	    g.setColor(Color.blue);
	    g.drawString("Cursor",x,y);
	    
	    g.setColor(Color.black);
	    double testlength = state.xpos_meters;
	    int range = 7;
	    if(state.lineLength < 1.0){
		range = 7;
	    }
	    else if(state.lineLength >= 1.0 && state.lineLength < 10.0){
		range = 6;
	    }
	    else if(state.lineLength >= 10.0 && state.lineLength < 100.0){
		range = 5;
	    }
	    else if(state.lineLength >= 100.0 && state.lineLength < 1000.0){
		range = 4;
	    }
	    else if(state.lineLength >= 1000.0 && state.lineLength < 10000.0){
		range = 3;
	    }
            
	    else if(state.lineLength >= 10000.0 && state.lineLength < 100000.0){
		range = 2;
	    }
	    else if(state.lineLength >= 100000.0){
		range = 1;
	    }
            
          g.drawString("    d",x+dx,y);
	    //g.drawString("         = "+MaestroA.rounder(state.xpos,range),x+dx,y);	
          MaestroG.subscripterSanSym2("         = "+MaestroA.rounder(state.xpos,range),"","",""+lambda,g,11,x+dx,y);
                
            //g.setFont(symbolfont);
	    //g.drawString("\u03bb",x+dx+fm.stringWidth("    d   = "+MaestroA.rounder(state.xpos,range))+5,y);
	    //g.setFont(normalfont);
            
          y += dy;
	    
            //------------------------------------------------------------------------------------------
	    if(testlength < 1.0E-9 && testlength > 0.0){
		g.drawString("         = "+MaestroA.rounder(state.xpos_meters*1.0e9,8)+" nm",x+dx,y);	
	    }
	    else if(testlength < 1.0E-6 && testlength >= 1.0E-9){
		g.drawString("         = "+MaestroA.rounder(state.xpos_meters*1.0e9,4)+" nm",x+dx,y);	
	    }
	    else if(testlength < 1.0E-3 && testlength >= 1.0E-6){
		g.drawString("         = "+MaestroA.rounder(state.xpos_meters*1.0e6,4)+" \u00b5m",x+dx,y);	
	    }
	    else if(testlength < 1.0 && testlength >= 1.0E-3){
		g.drawString("         = "+MaestroA.rounder(state.xpos_meters*1000,4)+" mm",x+dx,y);	
	    }
	    else if((testlength < 1000.0 && testlength >= 1.0 ) || testlength == 0.0){
		g.drawString("         = "+MaestroA.rounder(state.xpos_meters,6)+" m",x+dx,y);	
	    }
	    else if(testlength >= 1000.0 && testlength < 1.0E6){
		g.drawString("         = "+MaestroA.rounder(state.xpos_meters/1000.0,4)+" km",x+dx,y);	
	    }
	    else if(testlength >= 1.0E6 && testlength < 1.0E9){
		g.drawString("         = "+MaestroA.rounder(state.xpos_meters/1.0E6,4)+" Mm",x+dx,y);	
	    }
	    else if(testlength >= 1.0E9){
		g.drawString("         = "+MaestroA.rounder(state.xpos_meters/1.0E9,4)+" Gm",x+dx,y);	
	    }
	    
            // end of new code           
            
	    g.setColor(Color.white);	   
	    g.drawLine(5,y+dyy/3,getSize().width-5,y+dyy/3);
	    
	    y += dyy;
	    dx = 80;
            double testmag = Complex.Magnitude(state.Zin);
            Complex Zmag = state.Zin;

            double testmag2 = Complex.Magnitude(state.Yin);
            Complex Ymag = state.Yin;
            //System.out.println("in output"+state.Zin+"   "+state.ZL);
        
                if(Complex.Real(state.Gammain) > 0.999999 && Math.abs(Complex.Imaginary(state.Gammain)) < 0.000001){
		    Gamma_plusone = true;
		    Gamma_minusone = false;
		}
		else if(Complex.Real(state.Gammain) < -0.999999 && Math.abs(Complex.Imaginary(state.Gammain)) < 0.000001){
		    Gamma_plusone = false;
		    Gamma_minusone = true;
		}
		else{
		    Gamma_plusone = false;
		    Gamma_minusone = false;
		}
	    
            g.setColor(Color.red);
            g.drawString("Impedance",x,y);
            //g.drawString("  [ "+Ohm+" ]",x,y+dy);  
            MaestroG.SansNosansSymb2("",""," [ "+Ohm+" ]",g,10,x,y+dy);
            g.setColor(Color.black); 
            	
                MaestroG.subscripter("Z","","(d)",g,11,x+dx,y);
                int xinit2, xinit3;
                xinit2 = x+dxx+95;
                    
                if((state.IsLoadOpen || state.IsLoadImaginary) && Gamma_plusone){
		    MaestroG.subscripterInfinityOne("= ","","","",g,11,xinit2,y);
                    
                    g.drawString("=  (Open Circuit)  " ,xinit2,y+dy);
                    y+=dy;
		}
		else if((state.IsLoadOpen || state.IsLoadImaginary) && Gamma_minusone){
		    MaestroG.subscripter("= 0.0 + j 0.0","","",g,11,xinit2,y);
                    MaestroG.SansPLAIN("= 0.0","  \u2220 ",""+0.0+" rad",g,11,xinit2,y+dy);
                    y+=dy;
		}
		else if((state.IsLoadShort || state.IsLoadImaginary) && Gamma_plusone){
		    //MaestroG.subscripter("= ","",""+infinity,g,11,xinit2,y);
                    MaestroG.subscripterInfinityOne("= ","","","",g,11,xinit2,y);
                    g.drawString("=  (Open Circuit)  " ,xinit2,y+dy);
                    y+=dy;
		}
		else if((state.IsLoadShort || state.IsLoadImaginary) && Gamma_minusone){
		    MaestroG.subscripter("= 0.0 + j 0.0","","",g,11,xinit2,y);
                    MaestroG.SansPLAIN("= 0.0","  \u2220 ",""+0.0+" rad",g,11,xinit2,y+dy);
                    y+=dy;
		}
   
		else{
                
                    tempR=0.0; tempX=0.0;
                    stepx = 0;
                    
		    if(Complex.Imaginary(state.Zin) >= 0.0){sign = plusj;}
		    else{sign = minusj;}
		    
		    if(state.IsLoadImaginary || state.IsLoadOpen || state.IsLoadShort){
			tempR = 0.0;
		    }
		    else if(state.IsLoadRegular){
			tempR = state.Zin.Real();
		    }
		    
		    if(tempR < 1.0E3 && tempR >= 1.0E-3){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR,6),"","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR,6));
		    }
		    else if(tempR == 0.0){
			MaestroG.superscripter("= 0.0","","",g,11,xinit2,y);
			stepx = fm.stringWidth("= 0.0 ");
		    }
		    else if(tempR < 1.0E6 && tempR >= 1.0E3){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E-3,2)+" x 10","3","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E-3,2)+"x 10 3");
		    }
		    else if(tempR < 1.0E9 && tempR >= 1.0E6){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E-6,2)+" x 10","6","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E-6,2)+"x 10 6");
		    }
		    else if(tempR < 1.0E12 && tempR >= 1.0E9){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E-9,2)+" x 10","9","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E-9,2)+"x 10 9");
		    }
		    else if(tempR < 1.0E15 && tempR >= 1.0E12){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E-12,2)+" x 10","12","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E-12,2)+"x 10 12");
		    }
		    else if(tempR < 1.0E18 && tempR >= 1.0E15){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E-15,2)+" x 10","15","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E-15,2)+"x 10 15");
		    }
		    else if(tempR < 1.0E21 && tempR >= 1.0E18){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E-18,2)+" x 10","18","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E-18,2)+"x 10 18");
		    }
		    else if(tempR < 1.0E24 && tempR >= 1.0E21){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E-21,2)+" x 10","21","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E-21,2)+"x 10 21");
		    }
		    else if(tempR < 1.0E27 && tempR >= 1.0E24){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E-24,2)+" x 10","24","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E-24,2)+"x 10 24");
		    }
		    else if(tempR < 1.0E30 && tempR >= 1.0E27){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E-27,2)+" x 10","27","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E-27,2)+"x 10 27");
		    }
		    else if(tempR >= 1.0E30){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E-30,2)+" x 10","30","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E-30,2)+"x 10 30");
		    }
		    else if(tempR < 1.0E-3 && tempR >= 1.0E-6){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E6,2)+" x 10","-6","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E6,2)+"x 10 -6");
		    }
		    else if(tempR < 1.0E-6 && tempR >= 1.0E-9){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E9,2)+" x 10","-9","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E9,2)+"x 10 -9");
		    }
		    else if(tempR < 1.0E-9 && tempR >= 1.0E-12){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E12,2)+" x 10","-12","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E12,2)+"x 10 -12");
		    }
		    else if(tempR < 1.0E-12 && tempR >= 1.0E-15){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E15,2)+" x 10","-15","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E15,2)+"x 10 -15");
		    }
		    else if(tempR < 1.0E-15 && tempR >= 1.0E-18){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E18,2)+" x 10","-18","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E18,2)+"x 10 -18");
		    }
		    else if(tempR < 1.0E-18 && tempR >= 1.0E-21){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E21,2)+" x 10","-21","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E21,2)+"x 10 -21");
		    }
		    else if(tempR < 1.0E-21 && tempR >= 1.0E-24){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E24,2)+" x 10","-24","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E24,2)+"x 10 -24");
		    }
                    else if(tempR < 1.0E-24 && tempR >= 1.0E-27){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E27,2)+" x 10","-27","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E27,2)+"x 10 -27");
		    }
                    else if(tempR < 1.0E-27 && tempR >= 1.0E-30){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E30,2)+" x 10","-30","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E30,2)+"x 10 -30");
		    }
                    else if(tempR < 1.0E-30 && tempR != 0.0){
			MaestroG.superscripter("= 0.0","","",g,11,xinit2,y);
			stepx = fm.stringWidth("= 0.0");
		    }
		    
		    tempX = Math.abs(state.Zin.Imaginary());
		    xinit3 = xinit2+stepx;
		    
		    if(tempX < 1.0E3 && tempX >= 1.0E-3){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX,6),"","",g,11,xinit3,y);
		    }
		    else if(tempX == 0.0){
			MaestroG.superscripter(" + j 0.0","","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E6 && tempX >= 1.0E3){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-3,2)+" x 10","3","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E9 && tempX >= 1.0E6){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-6,2)+" x 10","6","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E12 && tempX >= 1.0E9){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-9,2)+" x 10","9","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E15 && tempX >= 1.0E12){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-12,2)+" x 10","12","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E18 && tempX >= 1.0E15){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-15,2)+" x 10","15","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E21 && tempX >= 1.0E18){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-18,2)+" x 10","18","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E24 && tempX >= 1.0E21){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-21,2)+" x 10","21","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E27 && tempX >= 1.0E24){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-24,2)+" x 10","24","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E30 && tempX >= 1.0E27){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-27,2)+" x 10","27","",g,11,xinit3,y);
		    }
		    else if(tempX >= 1.0E30){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-30,2)+" x 10","30","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-3 && tempX >= 1.0E-6){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E6,2)+" x 10","-6","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-6 && tempX >= 1.0E-9){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E9,2)+" x 10","-9","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-9 && tempX >= 1.0E-12){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E12,2)+" x 10","-12","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-12 && tempX >= 1.0E-15){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E15,2)+" x 10","-15","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-15 && tempX >= 1.0E-18){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E18,2)+" x 10","-18","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-18 && tempX >= 1.0E-21){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E21,2)+" x 10","-21","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-21 && tempX >= 1.0E-24){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E24,2)+" x 10","-24","",g,11,xinit3,y);
		    }
                    else if(tempX < 1.0E-24 && tempX >= 1.0E-27){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E27,2)+" x 10","-27","",g,11,xinit3,y);
		    }
                    else if(tempX < 1.0E-27 && tempX >= 1.0E-30){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E30,2)+" x 10","-30","",g,11,xinit3,y);
		    }
                    else if(tempX < 1.0E-30 && tempX != 0.0){
			MaestroG.superscripter(sign+" 0.0","","",g,11,xinit3,y);
		    }
		//}
                
                ///-----------------------------------------------------------------------       
                
                y += dy;
           	    
		    tempR = Complex.Magnitude(state.Zin);
                    double dtmp2;
     
                    if(tempR == 0.0){dtmp2 = 0.0;}
                    else{dtmp2=MaestroA.rounder(state.Zin.Arg2(),4);}
                
                    		    
		    if(tempR < 1.0E3 && tempR >= 1.0E-3){
                        MaestroG.SansPLAIN("= "+MaestroA.rounder(tempR,6),"  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR == 0.0){
			MaestroG.SansPLAIN("= 0.0","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E6 && tempR >= 1.0E3){
                        MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-3,2)+" x 10","3","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E9 && tempR >= 1.0E6){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-6,2)+" x 10","6","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E12 && tempR >= 1.0E9){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-9,2)+" x 10","9","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E15 && tempR >= 1.0E12){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-12,2)+" x 10","12","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E18 && tempR >= 1.0E15){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-15,2)+" x 10","15","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E21 && tempR >= 1.0E18){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-18,2)+" x 10","18","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E24 && tempR >= 1.0E21){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-21,2)+" x 10","21","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E27 && tempR >= 1.0E24){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-24,2)+" x 10","24","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E30 && tempR >= 1.0E27){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-27,2)+" x 10","27","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR >= 1.0E30){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-30,2)+" x 10","30","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-3 && tempR >= 1.0E-6){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E6,2)+" x 10","-6","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-6 && tempR >= 1.0E-9){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E9,2)+" x 10","-9","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-9 && tempR >= 1.0E-12){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E12,2)+" x 10","-12","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-12 && tempR >= 1.0E-15){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E15,2)+" x 10","-15","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-15 && tempR >= 1.0E-18){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E18,2)+" x 10","-18","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-18 && tempR >= 1.0E-21){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E21,2)+" x 10","-21","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-21 && tempR >= 1.0E-24){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E24,2)+" x 10","-24","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
                    else if(tempR < 1.0E-24 && tempR >= 1.0E-27){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E27,2)+" x 10","-27","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
                    else if(tempR < 1.0E-27 && tempR >= 1.0E-30){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E30,2)+" x 10","-30","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
                    else if(tempR < 1.0E-30 && tempR != 0.0){
			MaestroG.SansPLAIN("= 0.0","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
            }

            g.setColor(new Color(120,120,120));
	    g.drawLine(5,y+dyy/3,getSize().width-5,y+dyy/3);
	                
	    y += dyy;
	    
            g.setColor(Color.red);
            g.drawString("Admittance",x,y);
            g.drawString("  [ S ]",x,y+dy);  
            g.setColor(Color.black); 
            
            MaestroG.subscripter("Y","","(d)",g,11,x+dx,y);
               
                xinit2 = x+dxx+95;
                    
                if((state.IsLoadOpen || state.IsLoadImaginary) && Gamma_plusone){
		    MaestroG.subscripter("= 0.0 + j 0.0","","",g,11,xinit2,y);
                    MaestroG.SansPLAIN("= 0.0","  \u2220 ",""+0.0+" rad",g,11,xinit2,y+dy);
                    y+=dy;
		}
		else if((state.IsLoadOpen || state.IsLoadImaginary) && Gamma_minusone){
                    //MaestroG.subscripter("= ","",""+infinity,g,11,xinit2,y);
                    MaestroG.subscripterInfinityOne("= ","","","",g,11,xinit2,y);
                    g.drawString("=  (Short Circuit)  " ,xinit2,y+dy);
                    y+=dy;
		}
		else if((state.IsLoadShort || state.IsLoadImaginary) && Gamma_plusone){
		    MaestroG.subscripter("= 0.0 + j 0.0","","",g,11,xinit2,y);
                    MaestroG.SansPLAIN("= 0.0","  \u2220 ",""+0.0+" rad",g,11,xinit2,y+dy);
                    y+=dy;
		}
		else if((state.IsLoadShort || state.IsLoadImaginary) && Gamma_minusone){
		    //MaestroG.subscripter("= ","",""+infinity,g,11,xinit2,y);
                    MaestroG.subscripterInfinityOne("= ","","","",g,11,xinit2,y);
                    g.drawString("=  (Short Circuit)  " ,xinit2,y+dy);
                    y+=dy;
		}
   
		else{
                
                    tempR=0.0; tempX=0.0;
                    stepx = 0;
                    
		    if(Complex.Imaginary(state.Yin) >= 0.0){sign = plusj;}
		    else{sign = minusj;}
		    
		    if(state.IsLoadImaginary || state.IsLoadOpen || state.IsLoadShort){
			tempR = 0.0;
		    }
		    else if(state.IsLoadRegular){
			tempR = state.Yin.Real();
		    }
		    
		    if(tempR < 1.0E3 && tempR >= 1.0E-3){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR,6),"","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR,6));
		    }
		    else if(tempR == 0.0){
			MaestroG.superscripter("= 0.0","","",g,11,xinit2,y);
			stepx = fm.stringWidth("= 0.0 ");
		    }
		    else if(tempR < 1.0E6 && tempR >= 1.0E3){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E-3,2)+" x 10","3","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E-3,2)+"x 10 3");
		    }
		    else if(tempR < 1.0E9 && tempR >= 1.0E6){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E-6,2)+" x 10","6","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E-6,2)+"x 10 6");
		    }
		    else if(tempR < 1.0E12 && tempR >= 1.0E9){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E-9,2)+" x 10","9","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E-9,2)+"x 10 9");
		    }
		    else if(tempR < 1.0E15 && tempR >= 1.0E12){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E-12,2)+" x 10","12","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E-12,2)+"x 10 12");
		    }
		    else if(tempR < 1.0E18 && tempR >= 1.0E15){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E-15,2)+" x 10","15","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E-15,2)+"x 10 15");
		    }
		    else if(tempR < 1.0E21 && tempR >= 1.0E18){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E-18,2)+" x 10","18","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E-18,2)+"x 10 18");
		    }
		    else if(tempR < 1.0E24 && tempR >= 1.0E21){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E-21,2)+" x 10","21","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E-21,2)+"x 10 21");
		    }
		    else if(tempR < 1.0E27 && tempR >= 1.0E24){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E-24,2)+" x 10","24","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E-24,2)+"x 10 24");
		    }
		    else if(tempR < 1.0E30 && tempR >= 1.0E27){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E-27,2)+" x 10","27","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E-27,2)+"x 10 27");
		    }
		    else if(tempR >= 1.0E30){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E-30,2)+" x 10","30","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E-30,2)+"x 10 30");
		    }
		    else if(tempR < 1.0E-3 && tempR >= 1.0E-6){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E6,2)+" x 10","-6","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E6,2)+"x 10 -6");
		    }
		    else if(tempR < 1.0E-6 && tempR >= 1.0E-9){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E9,2)+" x 10","-9","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E9,2)+"x 10 -9");
		    }
		    else if(tempR < 1.0E-9 && tempR >= 1.0E-12){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E12,2)+" x 10","-12","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E12,2)+"x 10 -12");
		    }
		    else if(tempR < 1.0E-12 && tempR >= 1.0E-15){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E15,2)+" x 10","-15","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E15,2)+"x 10 -15");
		    }
		    else if(tempR < 1.0E-15 && tempR >= 1.0E-18){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E18,2)+" x 10","-18","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E18,2)+"x 10 -18");
		    }
		    else if(tempR < 1.0E-18 && tempR >= 1.0E-21){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E21,2)+" x 10","-21","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E21,2)+"x 10 -21");
		    }
		    else if(tempR < 1.0E-21 && tempR >= 1.0E-24){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E24,2)+" x 10","-24","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E24,2)+"x 10 -24");
		    }
                    else if(tempR < 1.0E-24 && tempR >= 1.0E-27){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E27,2)+" x 10","-27","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E27,2)+"x 10 -27");
		    }
                    else if(tempR < 1.0E-27 && tempR >= 1.0E-30){
			MaestroG.superscripter("= "+MaestroA.rounder(tempR*1.0E30,2)+" x 10","-30","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+MaestroA.rounder(tempR*1.0E30,2)+"x 10 -30");
		    }
                    else if(tempR < 1.0E-30 && tempR != 0.0){
			MaestroG.superscripter("= 0.0","","",g,11,xinit2,y);
			stepx = fm.stringWidth("= 0.0");
		    }
		    
		    tempX = Math.abs(state.Yin.Imaginary());
		    xinit3 = xinit2+stepx;
		    
		    if(tempX < 1.0E3 && tempX >= 1.0E-3){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX,6),"","",g,11,xinit3,y);
		    }
		    else if(tempX == 0.0){
			MaestroG.superscripter(" + j 0.0","","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E6 && tempX >= 1.0E3){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-3,2)+" x 10","3","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E9 && tempX >= 1.0E6){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-6,2)+" x 10","6","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E12 && tempX >= 1.0E9){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-9,2)+" x 10","9","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E15 && tempX >= 1.0E12){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-12,2)+" x 10","12","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E18 && tempX >= 1.0E15){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-15,2)+" x 10","15","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E21 && tempX >= 1.0E18){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-18,2)+" x 10","18","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E24 && tempX >= 1.0E21){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-21,2)+" x 10","21","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E27 && tempX >= 1.0E24){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-24,2)+" x 10","24","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E30 && tempX >= 1.0E27){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-27,2)+" x 10","27","",g,11,xinit3,y);
		    }
		    else if(tempX >= 1.0E30){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-30,2)+" x 10","30","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-3 && tempX >= 1.0E-6){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E6,2)+" x 10","-6","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-6 && tempX >= 1.0E-9){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E9,2)+" x 10","-9","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-9 && tempX >= 1.0E-12){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E12,2)+" x 10","-12","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-12 && tempX >= 1.0E-15){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E15,2)+" x 10","-15","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-15 && tempX >= 1.0E-18){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E18,2)+" x 10","-18","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-18 && tempX >= 1.0E-21){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E21,2)+" x 10","-21","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-21 && tempX >= 1.0E-24){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E24,2)+" x 10","-24","",g,11,xinit3,y);
		    }
                    else if(tempX < 1.0E-24 && tempX >= 1.0E-27){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E27,2)+" x 10","-27","",g,11,xinit3,y);
		    }
                    else if(tempX < 1.0E-27 && tempX >= 1.0E-30){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E30,2)+" x 10","-30","",g,11,xinit3,y);
		    }
                    else if(tempX < 1.0E-30 && tempX != 0.0){
			MaestroG.superscripter(sign+" 0.0","","",g,11,xinit3,y);
		    }
		//}
                
                ///-----------------------------------------------------------------------       
                
                y += dy;
           	    
		    tempR = Complex.Magnitude(state.Yin);
                    double dtmp2;
     
                    if(tempR == 0.0){dtmp2 = 0.0;}
                    else{dtmp2=MaestroA.rounder(state.Yin.Arg2(),4);}
                
                    		    
		    if(tempR < 1.0E3 && tempR >= 1.0E-3){
                        MaestroG.SansPLAIN("= "+MaestroA.rounder(tempR,6),"  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR == 0.0){
			MaestroG.SansPLAIN("= 0.0","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E6 && tempR >= 1.0E3){
                        MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-3,2)+" x 10","3","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E9 && tempR >= 1.0E6){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-6,2)+" x 10","6","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E12 && tempR >= 1.0E9){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-9,2)+" x 10","9","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E15 && tempR >= 1.0E12){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-12,2)+" x 10","12","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E18 && tempR >= 1.0E15){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-15,2)+" x 10","15","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E21 && tempR >= 1.0E18){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-18,2)+" x 10","18","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E24 && tempR >= 1.0E21){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-21,2)+" x 10","21","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E27 && tempR >= 1.0E24){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-24,2)+" x 10","24","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E30 && tempR >= 1.0E27){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-27,2)+" x 10","27","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR >= 1.0E30){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-30,2)+" x 10","30","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-3 && tempR >= 1.0E-6){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E6,2)+" x 10","-6","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-6 && tempR >= 1.0E-9){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E9,2)+" x 10","-9","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-9 && tempR >= 1.0E-12){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E12,2)+" x 10","-12","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-12 && tempR >= 1.0E-15){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E15,2)+" x 10","-15","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-15 && tempR >= 1.0E-18){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E18,2)+" x 10","-18","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-18 && tempR >= 1.0E-21){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E21,2)+" x 10","-21","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-21 && tempR >= 1.0E-24){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E24,2)+" x 10","-24","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
                    else if(tempR < 1.0E-24 && tempR >= 1.0E-27){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E27,2)+" x 10","-27","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
                    else if(tempR < 1.0E-27 && tempR >= 1.0E-30){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E30,2)+" x 10","-30","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
                    else if(tempR < 1.0E-30 && tempR != 0.0){
			MaestroG.SansPLAIN("= 0.0","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
            }
            
	    	    
	    g.setColor(Color.black);
                                       
            g.setColor(Color.white);	
            g.drawLine(5,y+dyy/3,getSize().width-5,y+dyy/3);
	    y += dyy;
	    
	    g.setColor(Color.red);	    	    
	    g.drawString("Reflection",x,y);
	    
	    g.setColor(Color.black);
	    //g.setFont(symbolfont);
	    //g.drawString("\u0393",x+dx,y);
	    //g.setFont(normalfont);
	    //g.drawString("   (d)",x+dx,y);
            
            MaestroG.subscripterSS3(""+Gamma,"","(d)",g,11,x+dx,y);
	    g.drawString("= "+state.Gammain.toString(Complex.CARTESIAN,8,false),xinit2,y);
	    y += dy;
	    
	    g.setColor(Color.red);	
	    g.drawString("Coefficient",x,y);
	    g.setColor(Color.black);
            
                double gtmp1, gtmp2, gtmp3;
                    gtmp1=MaestroA.rounder(state.Gammain.Magnitude(),8);
                    if(gtmp1 == 0.0){gtmp2 = 0.0; gtmp3 = 0.0;}
                    else{
                        gtmp2=MaestroA.rounder(state.Gammain.Arg2(),6);
                        gtmp3=MaestroA.rounder(state.Gammain.Arg2()*180/Math.PI,6);
                    }
                MaestroG.SansPLAIN("= "+gtmp1,"  \u2220 ",""+gtmp2+" rad",g,11,xinit2,y);
	    
	    //g.drawString("         = "+state.Gammain.toString(Complex.POLAR_RADIAN,6,false),x+dx,y);
	    y += dy;
                MaestroG.SansPLAIN("= "+gtmp1,"  \u2220 ",""+gtmp3+" \u00ba",g,11,xinit2,y);
	    
	    //g.drawString("         = "+state.Gammain.toString(Complex.POLAR_DEGREE,6,false),x+dx,y);    
 
            g.setColor(new Color(120,120,120));
	    g.drawLine(5,y+dyy/3,getSize().width-5,y+dyy/3);    
	    y += dyy;
	    
	    g.setColor(Color.red);
	    g.drawString("Voltage",x,y);
            g.drawString("  [ V ]",x,y+dy); 
            g.setColor(Color.black);
            
            MaestroG.subscripter("V","","(d)",g,11,x+dx,y);
            fm = g.getFontMetrics();
            int goup = fm.getHeight();
            MaestroG.subscripter("~","","",g,13,x+dx,y-90*goup/200);
            tempR=0.0; tempX=0.0;
            stepx = 0;
                    
                    if(Complex.Real(state.Vin) >= 0.0){signr = plusr;}
		    else{signr = minusr;}
		    if(Complex.Imaginary(state.Vin) >= 0.0){sign = plusj;}
		    else{sign = minusj;}
		    
		    //if(state.IsLoadImaginary || state.IsLoadOpen || state.IsLoadShort){
			//tempR = 0.0;
		    //}
		    //else if(state.IsLoadRegular){
			tempR = Math.abs(state.Vin.Real());
		    //}
		    
		    if(tempR < 1.0E3 && tempR >= 1.0E-3){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR,6),"","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR,6));
		    }
		    else if(tempR == 0.0){
			MaestroG.superscripter("= 0.0","","",g,11,xinit2,y);
			stepx = fm.stringWidth("= 0.0 ");
		    }
		    else if(tempR < 1.0E6 && tempR >= 1.0E3){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-3,2)+" x 10","3","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-3,2)+"x 10 3");
		    }
		    else if(tempR < 1.0E9 && tempR >= 1.0E6){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-6,2)+" x 10","6","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-6,2)+"x 10 6");
		    }
		    else if(tempR < 1.0E12 && tempR >= 1.0E9){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-9,2)+" x 10","9","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-9,2)+"x 10 9");
		    }
		    else if(tempR < 1.0E15 && tempR >= 1.0E12){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-12,2)+" x 10","12","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-12,2)+"x 10 12");
		    }
		    else if(tempR < 1.0E18 && tempR >= 1.0E15){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-15,2)+" x 10","15","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-15,2)+"x 10 15");
		    }
		    else if(tempR < 1.0E21 && tempR >= 1.0E18){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-18,2)+" x 10","18","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-18,2)+"x 10 18");
		    }
		    else if(tempR < 1.0E24 && tempR >= 1.0E21){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-21,2)+" x 10","21","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-21,2)+"x 10 21");
		    }
		    else if(tempR < 1.0E27 && tempR >= 1.0E24){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-24,2)+" x 10","24","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-24,2)+"x 10 24");
		    }
		    else if(tempR < 1.0E30 && tempR >= 1.0E27){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-27,2)+" x 10","27","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-27,2)+"x 10 27");
		    }
		    else if(tempR >= 1.0E30){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-30,2)+" x 10","30","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-30,2)+"x 10 30");
		    }
		    else if(tempR < 1.0E-3 && tempR >= 1.0E-6){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E6,2)+" x 10","-6","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E6,2)+"x 10 -6");
		    }
		    else if(tempR < 1.0E-6 && tempR >= 1.0E-9){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E9,2)+" x 10","-9","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E9,2)+"x 10 -9");
		    }
		    else if(tempR < 1.0E-9 && tempR >= 1.0E-12){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E12,2)+" x 10","-12","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E12,2)+"x 10 -12");
		    }
		    else if(tempR < 1.0E-12 && tempR >= 1.0E-15){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E15,2)+" x 10","-15","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E15,2)+"x 10 -15");
		    }
		    else if(tempR < 1.0E-15 && tempR >= 1.0E-18){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E18,2)+" x 10","-18","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E18,2)+"x 10 -18");
		    }
		    else if(tempR < 1.0E-18 && tempR >= 1.0E-21){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E21,2)+" x 10","-21","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E21,2)+"x 10 -21");
		    }
		    else if(tempR < 1.0E-21 && tempR >= 1.0E-24){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E24,2)+" x 10","-24","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E24,2)+"x 10 -24");
		    }
                    else if(tempR < 1.0E-24 && tempR >= 1.0E-27){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E27,2)+" x 10","-27","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E27,2)+"x 10 -27");
		    }
                    else if(tempR < 1.0E-27 && tempR >= 1.0E-30){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E30,2)+" x 10","-30","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E30,2)+"x 10 -30");
		    }
                    else if(tempR < 1.0E-30 && tempR != 0.0){
			MaestroG.superscripter("= 0.0","","",g,11,xinit2,y);
			stepx = fm.stringWidth("= 0.0");
		    }
		    
		    tempX = Math.abs(state.Vin.Imaginary());
		    xinit3 = xinit2+stepx;
		    
		    if(tempX < 1.0E3 && tempX >= 1.0E-3){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX,6),"","",g,11,xinit3,y);
		    }
		    else if(tempX == 0.0){
			MaestroG.superscripter(" + j 0.0","","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E6 && tempX >= 1.0E3){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-3,2)+" x 10","3","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E9 && tempX >= 1.0E6){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-6,2)+" x 10","6","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E12 && tempX >= 1.0E9){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-9,2)+" x 10","9","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E15 && tempX >= 1.0E12){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-12,2)+" x 10","12","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E18 && tempX >= 1.0E15){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-15,2)+" x 10","15","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E21 && tempX >= 1.0E18){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-18,2)+" x 10","18","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E24 && tempX >= 1.0E21){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-21,2)+" x 10","21","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E27 && tempX >= 1.0E24){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-24,2)+" x 10","24","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E30 && tempX >= 1.0E27){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-27,2)+" x 10","27","",g,11,xinit3,y);
		    }
		    else if(tempX >= 1.0E30){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-30,2)+" x 10","30","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-3 && tempX >= 1.0E-6){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E6,2)+" x 10","-6","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-6 && tempX >= 1.0E-9){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E9,2)+" x 10","-9","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-9 && tempX >= 1.0E-12){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E12,2)+" x 10","-12","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-12 && tempX >= 1.0E-15){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E15,2)+" x 10","-15","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-15 && tempX >= 1.0E-18){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E18,2)+" x 10","-18","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-18 && tempX >= 1.0E-21){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E21,2)+" x 10","-21","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-21 && tempX >= 1.0E-24){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E24,2)+" x 10","-24","",g,11,xinit3,y);
		    }
                    else if(tempX < 1.0E-24 && tempX >= 1.0E-27){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E27,2)+" x 10","-27","",g,11,xinit3,y);
		    }
                    else if(tempX < 1.0E-27 && tempX >= 1.0E-30){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E30,2)+" x 10","-30","",g,11,xinit3,y);
		    }
                    else if(tempX < 1.0E-30 && tempX != 0.0){
			MaestroG.superscripter(sign+" 0.0","","",g,11,xinit3,y);
		    }
		//}
                
                ///-----------------------------------------------------------------------       
                
                y += dy;
           	    
		    tempR = Complex.Magnitude(state.Vin);
                    double dtmp2;
     
                    if(tempR == 0.0){dtmp2 = 0.0;}
                    else{dtmp2=MaestroA.rounder(state.Vin.Arg2(),4);}
                
       
		    if(tempR < 1.0E3 && tempR >= 1.0E-3){
                        MaestroG.SansPLAIN("= "+MaestroA.rounder(tempR,6),"  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR == 0.0){
			MaestroG.SansPLAIN("= 0.0","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E6 && tempR >= 1.0E3){
                        MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-3,2)+" x 10","3","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
                    }
		    else if(tempR < 1.0E9 && tempR >= 1.0E6){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-6,2)+" x 10","6","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E12 && tempR >= 1.0E9){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-9,2)+" x 10","9","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E15 && tempR >= 1.0E12){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-12,2)+" x 10","12","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E18 && tempR >= 1.0E15){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-15,2)+" x 10","15","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E21 && tempR >= 1.0E18){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-18,2)+" x 10","18","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E24 && tempR >= 1.0E21){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-21,2)+" x 10","21","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E27 && tempR >= 1.0E24){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-24,2)+" x 10","24","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E30 && tempR >= 1.0E27){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-27,2)+" x 10","27","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR >= 1.0E30){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-30,2)+" x 10","30","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-3 && tempR >= 1.0E-6){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E6,2)+" x 10","-6","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-6 && tempR >= 1.0E-9){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E9,2)+" x 10","-9","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-9 && tempR >= 1.0E-12){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E12,2)+" x 10","-12","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-12 && tempR >= 1.0E-15){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E15,2)+" x 10","-15","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-15 && tempR >= 1.0E-18){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E18,2)+" x 10","-18","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-18 && tempR >= 1.0E-21){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E21,2)+" x 10","-21","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-21 && tempR >= 1.0E-24){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E24,2)+" x 10","-24","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
                    else if(tempR < 1.0E-24 && tempR >= 1.0E-27){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E27,2)+" x 10","-27","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
                    else if(tempR < 1.0E-27 && tempR >= 1.0E-30){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E30,2)+" x 10","-30","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
                    else if(tempR < 1.0E-30 && tempR != 0.0){
			MaestroG.SansPLAIN("= 0.0","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
                    //--------------------------------------------------------------------------------------------------------------------------
	               
	    g.setColor(Color.white);	
	    g.drawLine(5,y+dyy/3,getSize().width-5,y+dyy/3);    
	    y += dyy;
            
            g.setColor(Color.red);
	    g.drawString("Current",x,y);
            g.drawString("  [ A ]",x,y+dy); 
            g.setColor(Color.black);
            
            MaestroG.subscripterSS("I","","(d)",g,11,x+dx,y);
            fm = g.getFontMetrics();
            goup = fm.getHeight();
            MaestroG.subscripter("~","","",g,13,x+dx-1,y-92*goup/200);
            
            tempR=0.0; tempX=0.0;
            stepx = 0;
                    
                    if(Complex.Real(state.Iin) >= 0.0){signr = plusr;}
		    else{signr = minusr;}
		    if(Complex.Imaginary(state.Iin) >= 0.0){sign = plusj;}
		    else{sign = minusj;}
		    
		    //if(state.IsLoadImaginary || state.IsLoadOpen || state.IsLoadShort){
			//tempR = 0.0;
		    //}
		    //else if(state.IsLoadRegular){
			tempR = Math.abs(state.Iin.Real());
		    //}
		    
		    if(tempR < 1.0E3 && tempR >= 1.0E-3){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR,6),"","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR,6));
		    }
		    else if(tempR == 0.0){
			MaestroG.superscripter("= 0.0","","",g,11,xinit2,y);
			stepx = fm.stringWidth("= 0.0 ");
		    }
		    else if(tempR < 1.0E6 && tempR >= 1.0E3){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-3,2)+" x 10","3","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-3,2)+"x 10 3");
		    }
		    else if(tempR < 1.0E9 && tempR >= 1.0E6){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-6,2)+" x 10","6","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-6,2)+"x 10 6");
		    }
		    else if(tempR < 1.0E12 && tempR >= 1.0E9){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-9,2)+" x 10","9","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-9,2)+"x 10 9");
		    }
		    else if(tempR < 1.0E15 && tempR >= 1.0E12){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-12,2)+" x 10","12","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-12,2)+"x 10 12");
		    }
		    else if(tempR < 1.0E18 && tempR >= 1.0E15){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-15,2)+" x 10","15","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-15,2)+"x 10 15");
		    }
		    else if(tempR < 1.0E21 && tempR >= 1.0E18){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-18,2)+" x 10","18","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-18,2)+"x 10 18");
		    }
		    else if(tempR < 1.0E24 && tempR >= 1.0E21){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-21,2)+" x 10","21","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-21,2)+"x 10 21");
		    }
		    else if(tempR < 1.0E27 && tempR >= 1.0E24){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-24,2)+" x 10","24","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-24,2)+"x 10 24");
		    }
		    else if(tempR < 1.0E30 && tempR >= 1.0E27){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-27,2)+" x 10","27","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-27,2)+"x 10 27");
		    }
		    else if(tempR >= 1.0E30){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-30,2)+" x 10","30","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-30,2)+"x 10 30");
		    }
		    else if(tempR < 1.0E-3 && tempR >= 1.0E-6){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E6,2)+" x 10","-6","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E6,2)+"x 10 -6");
		    }
		    else if(tempR < 1.0E-6 && tempR >= 1.0E-9){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E9,2)+" x 10","-9","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E9,2)+"x 10 -9");
		    }
		    else if(tempR < 1.0E-9 && tempR >= 1.0E-12){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E12,2)+" x 10","-12","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E12,2)+"x 10 -12");
		    }
		    else if(tempR < 1.0E-12 && tempR >= 1.0E-15){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E15,2)+" x 10","-15","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E15,2)+"x 10 -15");
		    }
		    else if(tempR < 1.0E-15 && tempR >= 1.0E-18){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E18,2)+" x 10","-18","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E18,2)+"x 10 -18");
		    }
		    else if(tempR < 1.0E-18 && tempR >= 1.0E-21){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E21,2)+" x 10","-21","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E21,2)+"x 10 -21");
		    }
		    else if(tempR < 1.0E-21 && tempR >= 1.0E-24){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E24,2)+" x 10","-24","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E24,2)+"x 10 -24");
		    }
                    else if(tempR < 1.0E-24 && tempR >= 1.0E-27){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E27,2)+" x 10","-27","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E27,2)+"x 10 -27");
		    }
                    else if(tempR < 1.0E-27 && tempR >= 1.0E-30){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E30,2)+" x 10","-30","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E30,2)+"x 10 -30");
		    }
                    else if(tempR < 1.0E-30 && tempR != 0.0){
			MaestroG.superscripter("= 0.0","","",g,11,xinit2,y);
			stepx = fm.stringWidth("= 0.0");
		    }
		    
		    tempX = Math.abs(state.Iin.Imaginary());
		    xinit3 = xinit2+stepx;
		    
		    if(tempX < 1.0E3 && tempX >= 1.0E-3){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX,6),"","",g,11,xinit3,y);
		    }
		    else if(tempX == 0.0){
			MaestroG.superscripter(" + j 0.0","","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E6 && tempX >= 1.0E3){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-3,2)+" x 10","3","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E9 && tempX >= 1.0E6){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-6,2)+" x 10","6","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E12 && tempX >= 1.0E9){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-9,2)+" x 10","9","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E15 && tempX >= 1.0E12){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-12,2)+" x 10","12","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E18 && tempX >= 1.0E15){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-15,2)+" x 10","15","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E21 && tempX >= 1.0E18){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-18,2)+" x 10","18","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E24 && tempX >= 1.0E21){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-21,2)+" x 10","21","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E27 && tempX >= 1.0E24){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-24,2)+" x 10","24","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E30 && tempX >= 1.0E27){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-27,2)+" x 10","27","",g,11,xinit3,y);
		    }
		    else if(tempX >= 1.0E30){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-30,2)+" x 10","30","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-3 && tempX >= 1.0E-6){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E6,2)+" x 10","-6","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-6 && tempX >= 1.0E-9){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E9,2)+" x 10","-9","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-9 && tempX >= 1.0E-12){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E12,2)+" x 10","-12","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-12 && tempX >= 1.0E-15){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E15,2)+" x 10","-15","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-15 && tempX >= 1.0E-18){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E18,2)+" x 10","-18","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-18 && tempX >= 1.0E-21){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E21,2)+" x 10","-21","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-21 && tempX >= 1.0E-24){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E24,2)+" x 10","-24","",g,11,xinit3,y);
		    }
                    else if(tempX < 1.0E-24 && tempX >= 1.0E-27){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E27,2)+" x 10","-27","",g,11,xinit3,y);
		    }
                    else if(tempX < 1.0E-27 && tempX >= 1.0E-30){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E30,2)+" x 10","-30","",g,11,xinit3,y);
		    }
                    else if(tempX < 1.0E-30 && tempX != 0.0){
			MaestroG.superscripter(sign+" 0.0","","",g,11,xinit3,y);
		    }
		//}
                
                ///-----------------------------------------------------------------------       
                
                y += dy;
           	    
		    tempR = Complex.Magnitude(state.Iin);
                        
                    if(tempR == 0.0){dtmp2 = 0.0;}
                    else{dtmp2=MaestroA.rounder(state.Iin.Arg2(),4);}
                
                    		    
		    if(tempR < 1.0E3 && tempR >= 1.0E-3){
                        MaestroG.SansPLAIN("= "+MaestroA.rounder(tempR,6),"  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR == 0.0){
			MaestroG.SansPLAIN("= 0.0","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E6 && tempR >= 1.0E3){
                        MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-3,2)+" x 10","3","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E9 && tempR >= 1.0E6){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-6,2)+" x 10","6","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E12 && tempR >= 1.0E9){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-9,2)+" x 10","9","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E15 && tempR >= 1.0E12){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-12,2)+" x 10","12","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E18 && tempR >= 1.0E15){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-15,2)+" x 10","15","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E21 && tempR >= 1.0E18){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-18,2)+" x 10","18","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E24 && tempR >= 1.0E21){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-21,2)+" x 10","21","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E27 && tempR >= 1.0E24){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-24,2)+" x 10","24","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E30 && tempR >= 1.0E27){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-27,2)+" x 10","27","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR >= 1.0E30){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-30,2)+" x 10","30","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-3 && tempR >= 1.0E-6){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E6,2)+" x 10","-6","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-6 && tempR >= 1.0E-9){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E9,2)+" x 10","-9","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-9 && tempR >= 1.0E-12){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E12,2)+" x 10","-12","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-12 && tempR >= 1.0E-15){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E15,2)+" x 10","-15","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-15 && tempR >= 1.0E-18){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E18,2)+" x 10","-18","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-18 && tempR >= 1.0E-21){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E21,2)+" x 10","-21","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-21 && tempR >= 1.0E-24){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E24,2)+" x 10","-24","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
                    else if(tempR < 1.0E-24 && tempR >= 1.0E-27){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E27,2)+" x 10","-27","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
                    else if(tempR < 1.0E-27 && tempR >= 1.0E-30){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E30,2)+" x 10","-30","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
                    else if(tempR < 1.0E-30 && tempR != 0.0){
			MaestroG.SansPLAIN("= 0.0","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
                    
                    float dmax, dmin;
		if(state.ZL.Imaginary()>0.0f){
		    dmax=(float)((state.GammaL.Arg2())/(4.0*Math.PI));
		    dmin=dmax+0.25f;
		}
		else{
		    dmax=(float)((state.GammaL.Arg2())/(4.0*Math.PI))+0.5f;
		    dmin=(float)((state.GammaL.Arg2())/(4.0*Math.PI))+0.25f;
		}
                
	    //g.drawString("Voltage Standing Wave Ratio",x,y);	
                    y += 6;
                    g.setColor(new Color(120,120,120));
                    g.drawLine(10,y,getSize().width-10,y);
                    y += dy;
                    
	    g.setColor(Color.black);
	    //g.drawString("VSWR",x+dxx+10,y);
	    //g.drawString("SWR (d)",xinit2-50,y);//+15);
	    
            String place;
            if(state.xpos == 0.0){place="(load)";}
            else{place="(cursor)";}
            
            xinit2 -= 50;
            
            double Sensitive; double VSWRin;
            Sensitive = Complex.Magnitude(state.Gammain);
            
            if(Sensitive > 1.0){Sensitive = 1.0;} 
                
                if(Sensitive == 1.0){
                    VSWRin = 1.0E130;
                }
                else{
                    VSWRin = (1.0+Sensitive)/(1-Sensitive);
                }
                
                if(VSWRin >= 1.0E10){
                    MaestroG.subscripter("SWR = ","","                  "+place, g, 11,xinit2,y);
                    MaestroG.subscripterInfinityOne("               ","","","",g,11,xinit2,y);
                }
                else if(VSWRin >= 1.0E9 && Math.abs(state.YS.Imaginary()) < 1.0E10){
                    MaestroG.superscripter("SWR = "+MaestroA.rounder(VSWRin/1.e9,3)+" x 10 ","9",""+place, g, 11,xinit2,y);
                }
                else if(VSWRin >= 1.0E8 && Math.abs(state.YS.Imaginary()) < 1.0E9){
                    MaestroG.superscripter("SWR = "+MaestroA.rounder(VSWRin/1.e8,3)+" x 10 ","8",""+place, g, 11,xinit2,y);
                }
                else if(VSWRin >= 1.0E7 && Math.abs(state.YS.Imaginary()) < 1.0E8){
                    MaestroG.superscripter("SWR = "+MaestroA.rounder(VSWRin/1.e7,3)+" x 10 ","7",""+place, g, 11,xinit2,y);
                }
                else if(VSWRin >= 1.0E6 && Math.abs(state.YS.Imaginary()) < 1.0E7){
                    MaestroG.superscripter("SWR = "+MaestroA.rounder(VSWRin/1.e6,3)+" x 10 ","6",""+place, g, 11,xinit2,y);
                }
                else if(VSWRin >= 1.0E5 && Math.abs(state.YS.Imaginary()) < 1.0E6){
                    MaestroG.superscripter("SWR = "+MaestroA.rounder(VSWRin/1.e5,3)+" x 10 ","5",""+place, g, 11,xinit2,y);
                }
                else if(VSWRin >= 1.0E4 && Math.abs(state.YS.Imaginary()) < 1.0E5){
                    MaestroG.superscripter("SWR = "+MaestroA.rounder(VSWRin/1.e4,3)+" x 10 ","4",""+place, g, 11,xinit2,y);
                }
                else if(VSWRin >= 1000.0 && Math.abs(state.YS.Imaginary()) < 1.0E4){
                    MaestroG.subscripter("SWR","", " = "+(int)VSWRin+" "+place, g, 11,xinit2,y);
                }
                else if(VSWRin > 1.5 && VSWRin <1000.0){
                    MaestroG.subscripter("SWR","", " = "+MaestroA.rounder(VSWRin,3)+" "+place, g, 11,xinit2,y);
                }
                else if(VSWRin <= 1.5 && VSWRin > 1.2){
                    MaestroG.subscripter("SWR","", " = "+MaestroA.rounder(VSWRin,3)+" "+place, g, 11,xinit2,y);
                }
                else if(VSWRin <= 1.2 && VSWRin > 1.1){
                    MaestroG.subscripter("SWR","", " = "+MaestroA.rounder(VSWRin,4)+" "+place, g, 11,xinit2,y);
                }
                else if(VSWRin <= 1.1 && VSWRin > 1.001){
                    MaestroG.subscripter("SWR","", " = "+MaestroA.rounder(VSWRin,4)+" "+place, g, 11,xinit2,y);
                }
                else if(VSWRin <= 1.001 && VSWRin > 1.000001){
                    MaestroG.subscripter("SWR","", " = "+MaestroA.rounder(VSWRin,6)+" "+place, g, 11,xinit2,y);
                }
                else if(VSWRin <= 1.000001){
                    MaestroG.subscripter("SWR","", " = "+MaestroA.rounder(VSWRin,9)+" "+place, g, 11,xinit2,y);
                }
            
	    y += 5;
	    g.setColor(Color.white);	
	    g.drawLine(5,y+dyy/4,getSize().width-5,y+dyy/4); 
	    
            y += dyy;
	    g.setColor(Color.red);
	    g.drawString("Length and Location of Transformer Line",x,y);
	    g.setColor(Color.black);
	    
	    y+= dyy;
            // CHANGE ==========================================================
            xinit2 = 10;
            //==================================================================
            
            MaestroG.subscripterSSym("L"," \u03bb/4","",g,13,xinit2,y);
            tempR=0.0; tempX=0.0;
            stepx = 0;
            
            xinit2 += 30;
            
            if(state.Transformer_meters >= 1.0E6){
                MaestroG.superscripter("= "+MaestroA.rounder(state.Transformer_meters/1.0E6,6)+" Mm","","",g,11,xinit2,y);
            }
            else if(state.Transformer_meters >= 1000.0 && state.Transformer_meters < 1.0E6){
                MaestroG.superscripter("= "+MaestroA.rounder(state.Transformer_meters/1000.0,6)+" km","","",g,11,xinit2,y);
            }
            else if(state.Transformer_meters >= 1.0 && state.Transformer_meters < 1000.0){
                MaestroG.superscripter("= "+MaestroA.rounder(state.Transformer_meters,6)+" m","","",g,11,xinit2,y);
            }
            else if(state.Transformer_meters >= 0.001 && state.Transformer_meters < 1.0){
                MaestroG.superscripter("= "+MaestroA.rounder(state.Transformer_meters*1000.0,6)+" mm","","",g,11,xinit2,y);
            }
            else if(state.Transformer_meters >= 1.0E-6 && state.Transformer_meters < 0.001){
                MaestroG.superscripter("= "+MaestroA.rounder(state.Transformer_meters*1.0E6,6)+" \u03bcm","","",g,11,xinit2,y);
            }
            else if(state.Transformer_meters >= 1.0E-9 && state.Transformer_meters < 1.0E-6){
                MaestroG.superscripter("= "+MaestroA.rounder(state.Transformer_meters*1.0E9,6)+" nm","","",g,11,xinit2,y);
            }
            
            // CHANGE ==========================================================
            //xinit2 -= 30;
            //y+= dyy;
            xinit2 = 160;
            //==================================================================
            
            MaestroG.subscripterSSym("d"," \u03bb/4","",g,13,xinit2,y);
            tempR=0.0; tempX=0.0;
            stepx = 0;
            
            xinit2 += 30;
            
            if(state.locations_meters[0] >= 1.0E6){
                MaestroG.superscripter("= "+MaestroA.rounder(state.locations_meters[0]/1.0E6,6)+" Mm","","",g,11,xinit2,y);
            }
            else if(state.locations_meters[0] >= 1000.0 && state.locations_meters[0] < 1.0E6){
                MaestroG.superscripter("= "+MaestroA.rounder(state.locations_meters[0]/1000.0,6)+" km","","",g,11,xinit2,y);
            }
            else if(state.locations_meters[0] >= 1.0 && state.locations_meters[0] < 1000.0){
                MaestroG.superscripter("= "+MaestroA.rounder(state.locations_meters[0],6)+" m","","",g,11,xinit2,y);
            }
            else if(state.locations_meters[0] >= 0.001 && state.locations_meters[0] < 1.0){
                MaestroG.superscripter("= "+MaestroA.rounder(state.locations_meters[0]*1000.0,6)+" mm","","",g,11,xinit2,y);
            }
            else if(state.locations_meters[0] >= 1.0E-6 && state.locations_meters[0] < 0.001){
                MaestroG.superscripter("= "+MaestroA.rounder(state.locations_meters[0]*1.0E6,6)+" \u03bcm","","",g,11,xinit2,y);
            }
            else if(state.locations_meters[0] >= 1.0E-9 && state.locations_meters[0] < 1.0E-6){
                MaestroG.superscripter("= "+MaestroA.rounder(state.locations_meters[0]*1.0E9,6)+" nm","","",g,11,xinit2,y);
            }
            else if(state.locations_meters[0] == 0.0){
                MaestroG.superscripter("= 0.0 m","","",g,11,xinit2,y);
            }
            
            //locations_meters[0]
            /*
	    y += dyy;
	    g.setColor(Color.red);
	    g.drawString("Input - Amplitude of Incident Voltage Wave  [ V ]",x,y);
	    g.setColor(Color.black);
	    
	    y+= dy;
            
            //-------------------------------------------------------------------------------
            //g.setColor(Color.red);
	    //g.drawString("",x,y);
            //g.drawString("  [ V ]",x,y+dy); 
            //g.setColor(Color.black);
            
            MaestroG.subscripter("V+","","",g,11,x+60,y);
            tempR=0.0; tempX=0.0;
            stepx = 0;
            xinit2 = x+dxxx;
            
                    
                    if(Complex.Real(state.VPlus) >= 0.0){signr = plusr;}
		    else{signr = minusr;}
		    if(Complex.Imaginary(state.VPlus) >= 0.0){sign = plusj;}
		    else{sign = minusj;}
		    
		    //if(state.IsLoadImaginary || state.IsLoadOpen || state.IsLoadShort){
			tempR = 0.0;
		    //}
		    //else if(state.IsLoadRegular){
			tempR = Math.abs(state.VPlus.Real());
		    //}
                     
                    
            
		    if(tempR < 1.0E3 && tempR >= 1.0E-3){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR,6),"","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR,6));
		    }
		    else if(tempR == 0.0){
			MaestroG.superscripter("= 0.0","","",g,11,xinit2,y);
			stepx = fm.stringWidth("= 0.0 ");
		    }
		    else if(tempR < 1.0E6 && tempR >= 1.0E3){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-3,2)+" x 10","3","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-3,2)+"x 10 3");
		    }
		    else if(tempR < 1.0E9 && tempR >= 1.0E6){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-6,2)+" x 10","6","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-6,2)+"x 10 6");
		    }
		    else if(tempR < 1.0E12 && tempR >= 1.0E9){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-9,2)+" x 10","9","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-9,2)+"x 10 9");
		    }
		    else if(tempR < 1.0E15 && tempR >= 1.0E12){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-12,2)+" x 10","12","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-12,2)+"x 10 12");
		    }
		    else if(tempR < 1.0E18 && tempR >= 1.0E15){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-15,2)+" x 10","15","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-15,2)+"x 10 15");
		    }
		    else if(tempR < 1.0E21 && tempR >= 1.0E18){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-18,2)+" x 10","18","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-18,2)+"x 10 18");
		    }
		    else if(tempR < 1.0E24 && tempR >= 1.0E21){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-21,2)+" x 10","21","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-21,2)+"x 10 21");
		    }
		    else if(tempR < 1.0E27 && tempR >= 1.0E24){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-24,2)+" x 10","24","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-24,2)+"x 10 24");
		    }
		    else if(tempR < 1.0E30 && tempR >= 1.0E27){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-27,2)+" x 10","27","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-27,2)+"x 10 27");
		    }
		    else if(tempR >= 1.0E30){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-30,2)+" x 10","30","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-30,2)+"x 10 30");
		    }
		    else if(tempR < 1.0E-3 && tempR >= 1.0E-6){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E6,2)+" x 10","-6","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E6,2)+"x 10 -6");
		    }
		    else if(tempR < 1.0E-6 && tempR >= 1.0E-9){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E9,2)+" x 10","-9","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E9,2)+"x 10 -9");
		    }
		    else if(tempR < 1.0E-9 && tempR >= 1.0E-12){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E12,2)+" x 10","-12","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E12,2)+"x 10 -12");
		    }
		    else if(tempR < 1.0E-12 && tempR >= 1.0E-15){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E15,2)+" x 10","-15","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E15,2)+"x 10 -15");
		    }
		    else if(tempR < 1.0E-15 && tempR >= 1.0E-18){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E18,2)+" x 10","-18","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E18,2)+"x 10 -18");
		    }
		    else if(tempR < 1.0E-18 && tempR >= 1.0E-21){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E21,2)+" x 10","-21","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E21,2)+"x 10 -21");
		    }
		    else if(tempR < 1.0E-21 && tempR >= 1.0E-24){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E24,2)+" x 10","-24","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E24,2)+"x 10 -24");
		    }
                    else if(tempR < 1.0E-24 && tempR >= 1.0E-27){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E27,2)+" x 10","-27","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E27,2)+"x 10 -27");
		    }
                    else if(tempR < 1.0E-27 && tempR >= 1.0E-30){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E30,2)+" x 10","-30","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E30,2)+"x 10 -30");
		    }
                    else if(tempR < 1.0E-30 && tempR != 0.0){
			MaestroG.superscripter("= 0.0","","",g,11,xinit2,y);
			stepx = fm.stringWidth("= 0.0");
		    }
		    
		    tempX = Math.abs(state.VPlus.Imaginary());
		    xinit3 = xinit2+stepx;
		    
		    if(tempX < 1.0E3 && tempX >= 1.0E-3){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX,6),"","",g,11,xinit3,y);
		    }
		    else if(tempX == 0.0){
			MaestroG.superscripter(" + j 0.0","","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E6 && tempX >= 1.0E3){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-3,2)+" x 10","3","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E9 && tempX >= 1.0E6){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-6,2)+" x 10","6","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E12 && tempX >= 1.0E9){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-9,2)+" x 10","9","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E15 && tempX >= 1.0E12){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-12,2)+" x 10","12","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E18 && tempX >= 1.0E15){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-15,2)+" x 10","15","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E21 && tempX >= 1.0E18){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-18,2)+" x 10","18","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E24 && tempX >= 1.0E21){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-21,2)+" x 10","21","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E27 && tempX >= 1.0E24){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-24,2)+" x 10","24","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E30 && tempX >= 1.0E27){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-27,2)+" x 10","27","",g,11,xinit3,y);
		    }
		    else if(tempX >= 1.0E30){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-30,2)+" x 10","30","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-3 && tempX >= 1.0E-6){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E6,2)+" x 10","-6","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-6 && tempX >= 1.0E-9){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E9,2)+" x 10","-9","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-9 && tempX >= 1.0E-12){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E12,2)+" x 10","-12","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-12 && tempX >= 1.0E-15){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E15,2)+" x 10","-15","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-15 && tempX >= 1.0E-18){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E18,2)+" x 10","-18","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-18 && tempX >= 1.0E-21){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E21,2)+" x 10","-21","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-21 && tempX >= 1.0E-24){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E24,2)+" x 10","-24","",g,11,xinit3,y);
		    }
                    else if(tempX < 1.0E-24 && tempX >= 1.0E-27){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E27,2)+" x 10","-27","",g,11,xinit3,y);
		    }
                    else if(tempX < 1.0E-27 && tempX >= 1.0E-30){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E30,2)+" x 10","-30","",g,11,xinit3,y);
		    }
                    else if(tempX < 1.0E-30 && tempX != 0.0){
			MaestroG.superscripter(sign+" 0.0","","",g,11,xinit3,y);
		    }
		//}
                
                ///-----------------------------------------------------------------------       
                
                y += dy;
           	    
		    tempR = Complex.Magnitude(state.VPlus);
                    
                    if(tempR == 0.0){dtmp2 = 0.0;}
                    else{dtmp2=MaestroA.rounder(state.VPlus.Arg2(),4);}
                
                    		    
		    if(tempR < 1.0E3 && tempR >= 1.0E-3){
                        MaestroG.SansPLAIN("= "+MaestroA.rounder(tempR,6),"  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR == 0.0){
			MaestroG.SansPLAIN("= 0.0","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E6 && tempR >= 1.0E3){
                        MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-3,2)+" x 10","3","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E9 && tempR >= 1.0E6){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-6,2)+" x 10","6","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E12 && tempR >= 1.0E9){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-9,2)+" x 10","9","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E15 && tempR >= 1.0E12){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-12,2)+" x 10","12","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E18 && tempR >= 1.0E15){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-15,2)+" x 10","15","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E21 && tempR >= 1.0E18){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-18,2)+" x 10","18","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E24 && tempR >= 1.0E21){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-21,2)+" x 10","21","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E27 && tempR >= 1.0E24){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-24,2)+" x 10","24","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E30 && tempR >= 1.0E27){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-27,2)+" x 10","27","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR >= 1.0E30){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-30,2)+" x 10","30","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-3 && tempR >= 1.0E-6){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E6,2)+" x 10","-6","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-6 && tempR >= 1.0E-9){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E9,2)+" x 10","-9","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-9 && tempR >= 1.0E-12){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E12,2)+" x 10","-12","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-12 && tempR >= 1.0E-15){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E15,2)+" x 10","-15","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-15 && tempR >= 1.0E-18){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E18,2)+" x 10","-18","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-18 && tempR >= 1.0E-21){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E21,2)+" x 10","-21","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-21 && tempR >= 1.0E-24){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E24,2)+" x 10","-24","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
                    else if(tempR < 1.0E-24 && tempR >= 1.0E-27){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E27,2)+" x 10","-27","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
                    else if(tempR < 1.0E-27 && tempR >= 1.0E-30){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E30,2)+" x 10","-30","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
                    else if(tempR < 1.0E-30 && tempR != 0.0){
			MaestroG.SansPLAIN("= 0.0","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }        
                 
	    g.setColor(new Color(120,120,120));
	    g.drawLine(5,y+dyy/4,getSize().width-5,y+dyy/4);  
	    
	    
	    g.setColor(Color.red);
	    y += dyy;
	    g.drawString("TIME-AVERAGE POWER", x, y);
	    y+= dy;
	    
            int dx1 = 40;
            g.setColor(Color.blue);
	    g.drawString("Injected (input wave)",x+dx+dx+10,y);
	    g.setColor(Color.black);
            
            g.drawString("P( in )",x,y);
	    if(state.Pw[3]>=1.0 && state.Pw[3]<=1.0E3 || state.Pw[3]==0.0){
		g.drawString("= "+MaestroA.rounder(state.Pw[3],6)+" [ W ]",x+dx1,y);
	    }
	    else if(state.Pw[3]<1.0E6 && state.Pw[3]>=1.0E3){
		temp = state.Pw[3]*1.0E-3;
		g.drawString("= "+MaestroA.rounder(temp,4)+" [ k W ]",x+dx1,y);
	    }
	    else if(state.Pw[3]>=1.0E6){
		temp = state.Pw[3]*1.0E-6;
		g.drawString("= "+MaestroA.rounder(temp,2)+" [ M W ]",x+dx1,y);
	    }
	    else if(state.Pw[3]<1.0 && state.Pw[3]>=0.001){
		temp = state.Pw[3]*1000;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ m W ]",x+dx1,y);
	    }
	    else if(state.Pw[3]<0.001 && state.Pw[3]>=1.0E-6){
		temp = state.Pw[3]*1.0E6;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ \u00b5 W ]",x+dx1,y);
	    }
	    else if(state.Pw[3]<1.0E-6 && state.Pw[3]>=1.0E-9){
		temp = state.Pw[3]*1.0E9;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ n W ]",x+dx1,y);
	    }
	    else if(state.Pw[3]<1.0E-9 && state.Pw[3]>=1.0E-12){
		temp = state.Pw[3]*1.0E12;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ p W ]",x+dx1,y);
	    }
	    else if(state.Pw[3]<1.0E-12 && state.Pw[3]>=1.0E-15){
		temp = state.Pw[3]*1.0E15;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ f W ]",x+dx1,y);
	    }
	    else if(state.Pw[3]<1.0E-15 && state.Pw[3]>=1.0E-18){
		temp = state.Pw[3]*1.0E18;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ a W ]",x+dx1,y);
	    }
	    else if(state.Pw[3]<1.0E-18){
		temp = 0.0;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ W ]",x+dx1,y);
	    }

            y += dy;
	    g.setColor(Color.blue);
	    g.drawString("Reflected to input",x+dx+dx+10,y);
	    
	    g.setColor(Color.black);
            g.drawString("P( refl )",x,y);
	    if(state.Pw[4]>=1.0 && state.Pw[4]<1.0E3 || state.Pw[4] == 0.0){
		g.drawString("= "+MaestroA.rounder(state.Pw[4],6)+" [ W ]",x+dx1,y);
	    }
	    else if(state.Pw[4]<1.0E6 && state.Pw[4]>=1.0E3){
		temp = state.Pw[4]*1.0E-3;
		g.drawString("= "+MaestroA.rounder(temp,4)+" [ k W ]",x+dx1,y);
	    }
	    else if(state.Pw[4]>=1.0E6){
		temp = state.Pw[4]*1.0E-6;
		g.drawString("= "+MaestroA.rounder(temp,2)+" [ M W ]",x+dx1,y);
	    }
	    else if(state.Pw[4]<1.0 && state.Pw[4]>=0.001){
		temp = state.Pw[4]*1000;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ m W ]",x+dx1,y);
	    }
	    else if(state.Pw[4]<0.001 && state.Pw[4]>=1.0E-6){
		temp = state.Pw[4]*1.0E6;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ \u00b5 W ]",x+dx1,y);
	    }
	    else if(state.Pw[4]<1.0E-6 && state.Pw[4]>=1.0E-9){
		temp = state.Pw[4]*1.0E9;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ n W ]",x+dx1,y);
	    }
	    else if(state.Pw[4]<1.0E-9 && state.Pw[4]>=1.0E-12){
		temp = state.Pw[4]*1.0E12;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ p W ]",x+dx1,y);
	    }
	    else if(state.Pw[4]<1.0E-12 && state.Pw[4]>=1.0E-15){
		temp = state.Pw[4]*1.0E15;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ f W ]",x+dx1,y);
	    }
	    else if(state.Pw[4]<1.0E-15 && state.Pw[4]>=1.0E-18){
		temp = state.Pw[4]*1.0E18;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ a W ]",x+dx1,y);
	    }
	    else if(state.Pw[4]<1.0E-18){
		temp = 0.0;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ W ]",x+dx1,y);
	    }
    	    //g.drawString("P( refl ) = "+MaestroA.rounder(state.Pw[4],4)+" [ W ]",x+dxx,y);
	    
	    g.setColor(Color.blue);
	    y += dy;
	    g.drawString("Absorbed by load",x+dx+dx+10,y);
	
	    g.setColor(Color.black);
            g.drawString("P( abs )",x,y);
	    if(state.Pw[1]==0.0){
		g.drawString("= "+MaestroA.rounder(state.Pw[1],7)+" [ W ]",x+dx1,y);
	    }
	    
	    else if(state.Pw[1]>=1.0 && state.Pw[1]<1.0E3){
		g.drawString("= "+MaestroA.rounder(state.Pw[1],6)+" [ W ]",x+dx1,y);
	    }
	    else if(state.Pw[1]<1.0E6 && state.Pw[1]>=1.0E3){
		temp = state.Pw[1]*1.0E-3;
		g.drawString("= "+MaestroA.rounder(temp,4)+" [ k W ]",x+dx1,y);
	    }
	    else if(state.Pw[1]>=1.0E6){
		temp = state.Pw[1]*1.0E-6;
		g.drawString("= "+MaestroA.rounder(temp,2)+" [ M W ]",x+dx1,y);
	    }
	    
	    else if(state.Pw[1]<1.0 && state.Pw[1]>=0.001){
		temp = state.Pw[1]*1000;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ m W ]",x+dx1,y);
	    }
	    else if(state.Pw[1]<0.001 && state.Pw[1]>=1.0E-6){
		temp = state.Pw[1]*1.0E6;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ \u00b5 W ]",x+dx1,y);
	    }
	    else if(state.Pw[1]<1.0E-6 && state.Pw[1]>=1.0E-9){
		temp = state.Pw[1]*1.0E9;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ n W ]",x+dx1,y);
	    }
	    else if(state.Pw[1]<1.0E-9 && state.Pw[1]>=1.0E-12){
		temp = state.Pw[1]*1.0E12;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ p W ]",x+dx1,y);
	    }
	    else if(state.Pw[1]<1.0E-12 && state.Pw[1]>=1.0E-15){
		temp = state.Pw[1]*1.0E15;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ f W ]",x+dx1,y);
	    }
	    else if(state.Pw[1]<1.0E-15 && state.Pw[1]>=1.0E-18){
		temp = state.Pw[1]*1.0E18;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ a W ]",x+dx1,y);
	    }
	    else if(state.Pw[1]<1.0E-18){
		temp = 0.0;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ W ]",x+dx1,y);
	    }
	    
	    //g.drawString("P( abs ) = "+MaestroA.rounder(state.Pw[1],4)+" [ W ]",x+dxx,y); 
	 
	    y += dy;
	    g.setColor(Color.blue);
	    g.drawString("Absorbed by Zg",x+dx+dx+10,y);
	    
	    g.setColor(Color.black);
            g.drawString("P( Zg )",x,y);
	    if(state.Pw[5]>=1.0 && state.Pw[5]<1.0E3 ||state.Pw[5]==0.0){
		g.drawString("= "+MaestroA.rounder(state.Pw[5],6)+" [ W ]",x+dx1,y);
	    }
	    
	    else if(state.Pw[5]<1.0E6 && state.Pw[5]>=1.0E3){
		temp = state.Pw[5]*1.0E-3;
		g.drawString("= "+MaestroA.rounder(temp,4)+" [ k W ]",x+dx1,y);
	    }
	    else if(state.Pw[5]>=1.0E6){
		temp = state.Pw[5]*1.0E-6;
		g.drawString("= "+MaestroA.rounder(temp,2)+" [ M W ]",x+dx1,y);
	    }
	    
	    else if(state.Pw[5]<1.0 && state.Pw[5]>=0.001){
		temp = state.Pw[5]*1000;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ m W ]",x+dx1,y);
	    }
	    else if(state.Pw[5]<0.001 && state.Pw[5]>=1.0E-6){
		temp = state.Pw[5]*1.0E6;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ \u00b5 W ]",x+dx1,y);
	    }
	    else if(state.Pw[5]<1.0E-6 && state.Pw[5]>=1.0E-9){
		temp = state.Pw[5]*1.0E9;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ n W ]",x+dx1,y);
	    }
	    else if(state.Pw[5]<1.0E-9 && state.Pw[5]>=1.0E-12){
		temp = state.Pw[5]*1.0E12;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ p W ]",x+dx1,y);
	    }
	    else if(state.Pw[5]<1.0E-12 && state.Pw[5]>=1.0E-15){
		temp = state.Pw[5]*1.0E15;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ f W ]",x+dx1,y);
	    }
	    else if(state.Pw[5]<1.0E-15 && state.Pw[5]>=1.0E-18){
		temp = state.Pw[5]*1.0E18;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ a W ]",x+dx1,y);
	    }
	    else if(state.Pw[5]<1.0E-18){
		temp = 0.0;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ W ]",x+dx1,y);
	    }
	    //g.drawString("P( Zg ) = "+MaestroA.rounder(state.Pw[5],4)+" [ W ]",x+dxx,y);
	    
	    y += dyy;
	    g.setColor(Color.red);
	    g.drawString("Total time-average power from the generator",x,y);
	    y += dy;
	    g.setColor(Color.black);
            
	    if(state.Pw[6]>=1.0 && state.Pw[6]<1.0E3 || state.Pw[6]==0.0){
		g.drawString("P( tot ) = P( abs ) + P( Zg ) = "+MaestroA.rounder(state.Pw[6],6)+" [ W ]",x,y);
	    }
	    else if(state.Pw[6]<1.0E6 && state.Pw[6]>=1.0E3){
		temp = state.Pw[6]*1.0E-3;
		g.drawString("P( tot ) = P( abs ) + P( Zg ) = "+MaestroA.rounder(temp,4)+" [ k W ]",x,y);
	    }
	    else if(state.Pw[6]>=1.0E6){
		temp = state.Pw[6]*1.0E-6;
		g.drawString("P( tot ) = P( abs ) + P( Zg ) = "+MaestroA.rounder(temp,2)+" [ M W ]",x,y);
	    }
	    else if(state.Pw[6]<1.0 && state.Pw[6]>=0.001){
		temp = state.Pw[6]*1000;
		g.drawString("P( tot ) = P( abs ) + P( Zg ) = "+MaestroA.rounder(temp,6)+" [ m W ]",x,y);
	    }
	    else if(state.Pw[6]<0.001 && state.Pw[6]>=1.0E-6){
		temp = state.Pw[6]*1.0E6;
		g.drawString("P( tot ) = P( abs ) + P( Zg ) = "+MaestroA.rounder(temp,6)+" [ \u00b5 W ]",x,y);
	    }
	    else if(state.Pw[6]<1.0E-6 && state.Pw[6]>=1.0E-9){
		temp = state.Pw[6]*1.0E9;
		g.drawString("P( tot ) = P( abs ) + P( Zg ) = "+MaestroA.rounder(temp,6)+" [ n W ]",x,y);
	    }
	    else if(state.Pw[6]<1.0E-9 && state.Pw[6]>=1.0E-12){
		temp = state.Pw[6]*1.0E12;
		g.drawString("P( tot ) = P( abs ) + P( Zg ) = "+MaestroA.rounder(temp,6)+" [ p W ]",x,y);
	    }
	    else if(state.Pw[6]<1.0E-12 && state.Pw[6]>=1.0E-15 ){
		temp = state.Pw[6]*1.0E15;
		g.drawString("P( tot ) = P( abs ) + P( Zg ) = "+MaestroA.rounder(temp,6)+" [ f W ]",x,y);
	    }
	    else if(state.Pw[6]<1.0E-15 && state.Pw[6]>=1.0E-18){
		temp = state.Pw[6]*1.0E18;
		g.drawString("P( tot ) = P( abs ) + P( Zg ) = "+MaestroA.rounder(temp,6)+" [ a W ]",x,y);
	    }
	    else if(state.Pw[6]<1.0E-18){
		temp = 0.0;
		g.drawString("P( tot ) = P( abs ) + P( Zg ) = "+MaestroA.rounder(temp,6)+" [ W ]",x,y);
	    }
            */
	}
        
}

class SpaceIndependentCanvas extends Canvas{
	private static final Font normalfont = new Font("SanSerif",Font.PLAIN,11);
	private static final Font symbolfont = new Font("Symbol",Font.PLAIN,12);
	private static final Font subfont    = new Font("SanSerif",Font.PLAIN,10);
	private Image im;
	private Graphics buf;
	Trans_State state;
        
         
	public SpaceIndependentCanvas(Trans_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, y, dx, dxx, dxxx, dy, dyy;
	    double temp;
	    Complex tempc;
	    FontMetrics fm;
            
            String alpha, Ohm, lambda, infinity, Gamma, plusj, minusj, 
                       sign, plusr, minusr, signr;
		g.setFont(symbolfont);
		alpha="\u03b1";
		lambda="\u03bb";
		Ohm="\u03a9";
		infinity="\u221e";
		Gamma="\u0393";
                g.setFont(normalfont);
		plusj =" + j ";
		minusj=" - j ";
                plusr ="";
                minusr =" - ";
                
	    
		float dmax, dmin;
		if(state.ZL.Imaginary()>0.0f){
		    dmax=(float)((state.GammaL.Arg2())/(4.0*Math.PI));
		    dmin=dmax+0.25f;
		}
		else{
		    dmax=(float)((state.GammaL.Arg2())/(4.0*Math.PI))+0.5f;
		    dmin=(float)((state.GammaL.Arg2())/(4.0*Math.PI))+0.25f;
		}

		while(dmax>0.5f) dmax=dmax-0.5f;
		while(dmin>0.5f) dmin=dmin-0.5f; 
	    
	    
	    x = 10;
	    y = 15;
	    dx = 80;
	    dxx = 15;
	    dxxx = 80;
	    g.setFont(normalfont);
	    fm = g.getFontMetrics();
	    dy = fm.getHeight();
	    dyy = dy+5;
	    g.clearRect(0,0,getSize().width,getSize().height);
	    g.setColor(Color.red);
	    //g.drawString("Voltage Standing Wave Ratio",x,y);	
	    //y += dy;
	    g.setColor(Color.red);
	    g.drawString("VSWR",x+dxx+10,y);
	    g.drawString("VSWR(d)",x+dxx+10,y+15);
	    g.setColor(Color.black);
	    
	    if(state.VSWR > 1.0e16){
                MaestroG.subscripterInfinityTwo("=  ","","","","           (load)",g,11,x+dxxx,y);
		//g.drawString("=             (load)",x+dxxx,y);
		//g.setFont(symbolfont);
		//g.drawString("\u221e",x+dxxx+20,y);
		//g.setFont(normalfont);
	    }
	    else if(state.VSWR >=100.0 && state.VSWR <= 1.0e16){
		g.drawString("= "+MaestroA.rounder(state.VSWR,2)+"  (load)",x+dxxx,y);
	    }
	    else{	
		g.drawString("= "+MaestroA.rounder(state.VSWR,4)+"  (load)",x+dxxx,y);
	    }
	    double VSWRin = (1.0+Complex.Magnitude(state.Gammain))/(1-Complex.Magnitude(state.Gammain));
	    
	    if(VSWRin > 1.0e16){
		//g.drawString("=             (cursor)",x+dxxx,y+15);
		MaestroG.subscripterInfinityTwo("=  ","","","","           (cursor)",g,11,x+dxxx,y+15);
                //g.setFont(symbolfont);
		//g.drawString("\u221e",x+dxxx+20,y+15);
		//g.setFont(normalfont);
		
                //g.drawString("VSWR(d) =   \u221e   (cursor)",x+dxx,y+15);
	    }
	    else if(VSWRin >=100.0 && VSWRin <= 1.0e16){
		g.drawString("= "+MaestroA.rounder(VSWRin,2)+"  (cursor)",x+dxxx,y+15);
	    }
	    else{	
		g.drawString("= "+MaestroA.rounder(VSWRin,4)+"  (cursor)",x+dxxx,y+15);
	    }
 
	    y += dy;
	    g.setColor(Color.white);	
	    g.drawLine(5,y+dyy/4,getSize().width-5,y+dyy/4); 
	    
	    y += dyy;
	    g.setColor(Color.red);
	    g.drawString("Amplitude of Incident Voltage Wave  [ V ]",x,y);
	    g.setColor(Color.black);
	    
	    y+= dy;
            
            //-------------------------------------------------------------------------------
            //g.setColor(Color.red);
	    //g.drawString("",x,y);
            //g.drawString("  [ V ]",x,y+dy); 
            //g.setColor(Color.black);
            
            MaestroG.subscripter("V+","","",g,11,x+60,y);
            double tempR=0.0; double tempX=0.0;
            int stepx = 0;
            int xinit2 = x+dxxx;
            
                    if(Complex.Real(state.VPlus) >= 0.0){signr = plusr;}
		    else{signr = minusr;}
		    if(Complex.Imaginary(state.VPlus) >= 0.0){sign = plusj;}
		    else{sign = minusj;}
		    
		    //if(state.IsLoadImaginary || state.IsLoadOpen || state.IsLoadShort){
			tempR = 0.0;
		    //}
		    //else if(state.IsLoadRegular){
			tempR = Math.abs(state.VPlus.Real());
		    //}
		    
		    if(tempR < 1.0E3 && tempR >= 1.0E-3){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR,6),"","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR,6));
		    }
		    else if(tempR == 0.0){
			MaestroG.superscripter("= 0.0","","",g,11,xinit2,y);
			stepx = fm.stringWidth("= 0.0 ");
		    }
		    else if(tempR < 1.0E6 && tempR >= 1.0E3){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-3,2)+" x 10","3","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-3,2)+"x 10 3");
		    }
		    else if(tempR < 1.0E9 && tempR >= 1.0E6){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-6,2)+" x 10","6","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-6,2)+"x 10 6");
		    }
		    else if(tempR < 1.0E12 && tempR >= 1.0E9){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-9,2)+" x 10","9","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-9,2)+"x 10 9");
		    }
		    else if(tempR < 1.0E15 && tempR >= 1.0E12){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-12,2)+" x 10","12","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-12,2)+"x 10 12");
		    }
		    else if(tempR < 1.0E18 && tempR >= 1.0E15){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-15,2)+" x 10","15","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-15,2)+"x 10 15");
		    }
		    else if(tempR < 1.0E21 && tempR >= 1.0E18){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-18,2)+" x 10","18","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-18,2)+"x 10 18");
		    }
		    else if(tempR < 1.0E24 && tempR >= 1.0E21){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-21,2)+" x 10","21","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-21,2)+"x 10 21");
		    }
		    else if(tempR < 1.0E27 && tempR >= 1.0E24){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-24,2)+" x 10","24","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-24,2)+"x 10 24");
		    }
		    else if(tempR < 1.0E30 && tempR >= 1.0E27){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-27,2)+" x 10","27","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-27,2)+"x 10 27");
		    }
		    else if(tempR >= 1.0E30){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E-30,2)+" x 10","30","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E-30,2)+"x 10 30");
		    }
		    else if(tempR < 1.0E-3 && tempR >= 1.0E-6){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E6,2)+" x 10","-6","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E6,2)+"x 10 -6");
		    }
		    else if(tempR < 1.0E-6 && tempR >= 1.0E-9){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E9,2)+" x 10","-9","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E9,2)+"x 10 -9");
		    }
		    else if(tempR < 1.0E-9 && tempR >= 1.0E-12){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E12,2)+" x 10","-12","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E12,2)+"x 10 -12");
		    }
		    else if(tempR < 1.0E-12 && tempR >= 1.0E-15){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E15,2)+" x 10","-15","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E15,2)+"x 10 -15");
		    }
		    else if(tempR < 1.0E-15 && tempR >= 1.0E-18){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E18,2)+" x 10","-18","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E18,2)+"x 10 -18");
		    }
		    else if(tempR < 1.0E-18 && tempR >= 1.0E-21){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E21,2)+" x 10","-21","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E21,2)+"x 10 -21");
		    }
		    else if(tempR < 1.0E-21 && tempR >= 1.0E-24){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E24,2)+" x 10","-24","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E24,2)+"x 10 -24");
		    }
                    else if(tempR < 1.0E-24 && tempR >= 1.0E-27){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E27,2)+" x 10","-27","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E27,2)+"x 10 -27");
		    }
                    else if(tempR < 1.0E-27 && tempR >= 1.0E-30){
			MaestroG.superscripter("= "+signr+""+MaestroA.rounder(tempR*1.0E30,2)+" x 10","-30","",g,11,xinit2,y);
			stepx = fm.stringWidth("= "+signr+""+MaestroA.rounder(tempR*1.0E30,2)+"x 10 -30");
		    }
                    else if(tempR < 1.0E-30 && tempR != 0.0){
			MaestroG.superscripter("= 0.0","","",g,11,xinit2,y);
			stepx = fm.stringWidth("= 0.0");
		    }
		    
		    tempX = Math.abs(state.VPlus.Imaginary());
		    int xinit3 = xinit2+stepx;
		    
		    if(tempX < 1.0E3 && tempX >= 1.0E-3){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX,6),"","",g,11,xinit3,y);
		    }
		    else if(tempX == 0.0){
			MaestroG.superscripter(" + j 0.0","","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E6 && tempX >= 1.0E3){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-3,2)+" x 10","3","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E9 && tempX >= 1.0E6){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-6,2)+" x 10","6","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E12 && tempX >= 1.0E9){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-9,2)+" x 10","9","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E15 && tempX >= 1.0E12){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-12,2)+" x 10","12","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E18 && tempX >= 1.0E15){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-15,2)+" x 10","15","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E21 && tempX >= 1.0E18){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-18,2)+" x 10","18","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E24 && tempX >= 1.0E21){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-21,2)+" x 10","21","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E27 && tempX >= 1.0E24){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-24,2)+" x 10","24","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E30 && tempX >= 1.0E27){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-27,2)+" x 10","27","",g,11,xinit3,y);
		    }
		    else if(tempX >= 1.0E30){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-30,2)+" x 10","30","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-3 && tempX >= 1.0E-6){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E6,2)+" x 10","-6","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-6 && tempX >= 1.0E-9){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E9,2)+" x 10","-9","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-9 && tempX >= 1.0E-12){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E12,2)+" x 10","-12","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-12 && tempX >= 1.0E-15){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E15,2)+" x 10","-15","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-15 && tempX >= 1.0E-18){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E18,2)+" x 10","-18","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-18 && tempX >= 1.0E-21){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E21,2)+" x 10","-21","",g,11,xinit3,y);
		    }
		    else if(tempX < 1.0E-21 && tempX >= 1.0E-24){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E24,2)+" x 10","-24","",g,11,xinit3,y);
		    }
                    else if(tempX < 1.0E-24 && tempX >= 1.0E-27){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E27,2)+" x 10","-27","",g,11,xinit3,y);
		    }
                    else if(tempX < 1.0E-27 && tempX >= 1.0E-30){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E30,2)+" x 10","-30","",g,11,xinit3,y);
		    }
                    else if(tempX < 1.0E-30 && tempX != 0.0){
			MaestroG.superscripter(sign+" 0.0","","",g,11,xinit3,y);
		    }
		//}
                
                ///-----------------------------------------------------------------------       
                
                y += dy;
           	    
		    tempR = Complex.Magnitude(state.VPlus);
                    double dtmp2;
     
                    if(tempR == 0.0){dtmp2 = 0.0;}
                    else{dtmp2=MaestroA.rounder(state.VPlus.Arg2(),4);}
                
                    		    
		    if(tempR < 1.0E3 && tempR >= 1.0E-3){
                        MaestroG.SansPLAIN("= "+MaestroA.rounder(tempR,6),"  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR == 0.0){
			MaestroG.SansPLAIN("= 0.0","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E6 && tempR >= 1.0E3){
                        MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-3,2)+" x 10","3","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E9 && tempR >= 1.0E6){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-6,2)+" x 10","6","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E12 && tempR >= 1.0E9){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-9,2)+" x 10","9","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E15 && tempR >= 1.0E12){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-12,2)+" x 10","12","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E18 && tempR >= 1.0E15){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-15,2)+" x 10","15","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E21 && tempR >= 1.0E18){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-18,2)+" x 10","18","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E24 && tempR >= 1.0E21){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-21,2)+" x 10","21","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E27 && tempR >= 1.0E24){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-24,2)+" x 10","24","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E30 && tempR >= 1.0E27){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-27,2)+" x 10","27","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR >= 1.0E30){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E-30,2)+" x 10","30","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-3 && tempR >= 1.0E-6){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E6,2)+" x 10","-6","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-6 && tempR >= 1.0E-9){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E9,2)+" x 10","-9","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-9 && tempR >= 1.0E-12){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E12,2)+" x 10","-12","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-12 && tempR >= 1.0E-15){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E15,2)+" x 10","-15","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-15 && tempR >= 1.0E-18){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E18,2)+" x 10","-18","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-18 && tempR >= 1.0E-21){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E21,2)+" x 10","-21","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
		    else if(tempR < 1.0E-21 && tempR >= 1.0E-24){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E24,2)+" x 10","-24","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
                    else if(tempR < 1.0E-24 && tempR >= 1.0E-27){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E27,2)+" x 10","-27","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
                    else if(tempR < 1.0E-27 && tempR >= 1.0E-30){
			MaestroG.SansPLAINSuper("= "+MaestroA.rounder(tempR*1.0E30,2)+" x 10","-30","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }
                    else if(tempR < 1.0E-30 && tempR != 0.0){
			MaestroG.SansPLAIN("= 0.0","  \u2220 ",""+dtmp2+" rad",g,11,xinit2,y);
		    }        
                    
	    g.setColor(new Color(120,120,120));
	    g.drawLine(5,y+dyy/4,getSize().width-5,y+dyy/4);  
	    y+= dyy;
	    
	    g.setColor(Color.red);
	    g.drawString("Location of First Voltage Maximum & Minimum",x,y);
	    y+= dy;
	    
	    g.setColor(Color.black);
	    g.drawString("d (max)",x+dxx+25,y);
            MaestroG.subscripterSanSym2("= "+MaestroA.rounder(dmax,5)+"","","",""+lambda,g,11,xinit2,y);
             
	    y+=dy;
	    
	    g.drawString("d (min)",x+dxx+25,y);
            MaestroG.subscripterSanSym2("= "+MaestroA.rounder(dmin,5)+"","","",""+lambda,g,11,xinit2,y);
             
	    g.setColor(Color.white);	
    	    g.drawLine(5,y+dyy/4,getSize().width-5,y+dyy/4);
	    
	    
	    g.setColor(Color.red);
	    y += dyy;
	    g.drawString("TIME-AVERAGE POWER", x, y);
	    y+= dy;
	    
            int dx1 = 40;
            g.setColor(Color.blue);
	    g.drawString("Injected (input wave)",x+dx+dx+10,y);
	    g.setColor(Color.black);
            
            g.drawString("P( in )",x,y);
	    if(state.Pw[3]>=1.0 && state.Pw[3]<=1.0E3 || state.Pw[3]==0.0){
		g.drawString("= "+MaestroA.rounder(state.Pw[3],6)+" [ W ]",x+dx1,y);
	    }
	    else if(state.Pw[3]<1.0E6 && state.Pw[3]>=1.0E3){
		temp = state.Pw[3]*1.0E-3;
		g.drawString("= "+MaestroA.rounder(temp,4)+" [ k W ]",x+dx1,y);
	    }
	    else if(state.Pw[3]>=1.0E6){
		temp = state.Pw[3]*1.0E-6;
		g.drawString("= "+MaestroA.rounder(temp,2)+" [ M W ]",x+dx1,y);
	    }
	    else if(state.Pw[3]<1.0 && state.Pw[3]>=0.001){
		temp = state.Pw[3]*1000;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ m W ]",x+dx1,y);
	    }
	    else if(state.Pw[3]<0.001 && state.Pw[3]>=1.0E-6){
		temp = state.Pw[3]*1.0E6;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ \u00b5 W ]",x+dx1,y);
	    }
	    else if(state.Pw[3]<1.0E-6 && state.Pw[3]>=1.0E-9){
		temp = state.Pw[3]*1.0E9;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ n W ]",x+dx1,y);
	    }
	    else if(state.Pw[3]<1.0E-9 && state.Pw[3]>=1.0E-12){
		temp = state.Pw[3]*1.0E12;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ p W ]",x+dx1,y);
	    }
	    else if(state.Pw[3]<1.0E-12 && state.Pw[3]>=1.0E-15){
		temp = state.Pw[3]*1.0E15;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ f W ]",x+dx1,y);
	    }
	    else if(state.Pw[3]<1.0E-15 && state.Pw[3]>=1.0E-18){
		temp = state.Pw[3]*1.0E18;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ a W ]",x+dx1,y);
	    }
	    else if(state.Pw[3]<1.0E-18){
		temp = 0.0;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ W ]",x+dx1,y);
	    }

            y += dy;
	    g.setColor(Color.blue);
	    g.drawString("Reflected by load",x+dx+dx+10,y);
	    
	    g.setColor(Color.black);
            g.drawString("P( refl )",x,y);
	    if(state.Pw[4]>=1.0 && state.Pw[4]<1.0E3 || state.Pw[4] == 0.0){
		g.drawString("= "+MaestroA.rounder(state.Pw[4],6)+" [ W ]",x+dx1,y);
	    }
	    else if(state.Pw[4]<1.0E6 && state.Pw[4]>=1.0E3){
		temp = state.Pw[4]*1.0E-3;
		g.drawString("= "+MaestroA.rounder(temp,4)+" [ k W ]",x+dx1,y);
	    }
	    else if(state.Pw[4]>=1.0E6){
		temp = state.Pw[4]*1.0E-6;
		g.drawString("= "+MaestroA.rounder(temp,2)+" [ M W ]",x+dx1,y);
	    }
	    else if(state.Pw[4]<1.0 && state.Pw[4]>=0.001){
		temp = state.Pw[4]*1000;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ m W ]",x+dx1,y);
	    }
	    else if(state.Pw[4]<0.001 && state.Pw[4]>=1.0E-6){
		temp = state.Pw[4]*1.0E6;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ \u00b5 W ]",x+dx1,y);
	    }
	    else if(state.Pw[4]<1.0E-6 && state.Pw[4]>=1.0E-9){
		temp = state.Pw[4]*1.0E9;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ n W ]",x+dx1,y);
	    }
	    else if(state.Pw[4]<1.0E-9 && state.Pw[4]>=1.0E-12){
		temp = state.Pw[4]*1.0E12;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ p W ]",x+dx1,y);
	    }
	    else if(state.Pw[4]<1.0E-12 && state.Pw[4]>=1.0E-15){
		temp = state.Pw[4]*1.0E15;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ f W ]",x+dx1,y);
	    }
	    else if(state.Pw[4]<1.0E-15 && state.Pw[4]>=1.0E-18){
		temp = state.Pw[4]*1.0E18;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ a W ]",x+dx1,y);
	    }
	    else if(state.Pw[4]<1.0E-18){
		temp = 0.0;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ W ]",x+dx1,y);
	    }
    	    //g.drawString("P( refl ) = "+MaestroA.rounder(state.Pw[4],4)+" [ W ]",x+dxx,y);
	    
	    g.setColor(Color.blue);
	    y += dy;
	    g.drawString("Absorbed by load",x+dx+dx+10,y);
	
	    g.setColor(Color.black);
            g.drawString("P( abs )",x,y);
	    if(state.Pw[1]==0.0){
		g.drawString("= "+MaestroA.rounder(state.Pw[1],7)+" [ W ]",x+dx1,y);
	    }
	    
	    else if(state.Pw[1]>=1.0 && state.Pw[1]<1.0E3){
		g.drawString("= "+MaestroA.rounder(state.Pw[1],6)+" [ W ]",x+dx1,y);
	    }
	    else if(state.Pw[1]<1.0E6 && state.Pw[1]>=1.0E3){
		temp = state.Pw[1]*1.0E-3;
		g.drawString("= "+MaestroA.rounder(temp,4)+" [ k W ]",x+dx1,y);
	    }
	    else if(state.Pw[1]>=1.0E6){
		temp = state.Pw[1]*1.0E-6;
		g.drawString("= "+MaestroA.rounder(temp,2)+" [ M W ]",x+dx1,y);
	    }
	    
	    else if(state.Pw[1]<1.0 && state.Pw[1]>=0.001){
		temp = state.Pw[1]*1000;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ m W ]",x+dx1,y);
	    }
	    else if(state.Pw[1]<0.001 && state.Pw[1]>=1.0E-6){
		temp = state.Pw[1]*1.0E6;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ \u00b5 W ]",x+dx1,y);
	    }
	    else if(state.Pw[1]<1.0E-6 && state.Pw[1]>=1.0E-9){
		temp = state.Pw[1]*1.0E9;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ n W ]",x+dx1,y);
	    }
	    else if(state.Pw[1]<1.0E-9 && state.Pw[1]>=1.0E-12){
		temp = state.Pw[1]*1.0E12;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ p W ]",x+dx1,y);
	    }
	    else if(state.Pw[1]<1.0E-12 && state.Pw[1]>=1.0E-15){
		temp = state.Pw[1]*1.0E15;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ f W ]",x+dx1,y);
	    }
	    else if(state.Pw[1]<1.0E-15 && state.Pw[1]>=1.0E-18){
		temp = state.Pw[1]*1.0E18;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ a W ]",x+dx1,y);
	    }
	    else if(state.Pw[1]<1.0E-18){
		temp = 0.0;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ W ]",x+dx1,y);
	    }
	    
	    //g.drawString("P( abs ) = "+MaestroA.rounder(state.Pw[1],4)+" [ W ]",x+dxx,y); 
	 
	    y += dy;
	    g.setColor(Color.blue);
	    g.drawString("Absorbed by Zg",x+dx+dx+10,y);
	    
	    g.setColor(Color.black);
            g.drawString("P( Zg )",x,y);
	    if(state.Pw[5]>=1.0 && state.Pw[5]<1.0E3 ||state.Pw[5]==0.0){
		g.drawString("= "+MaestroA.rounder(state.Pw[5],6)+" [ W ]",x+dx1,y);
	    }
	    
	    else if(state.Pw[5]<1.0E6 && state.Pw[5]>=1.0E3){
		temp = state.Pw[5]*1.0E-3;
		g.drawString("= "+MaestroA.rounder(temp,4)+" [ k W ]",x+dx1,y);
	    }
	    else if(state.Pw[5]>=1.0E6){
		temp = state.Pw[5]*1.0E-6;
		g.drawString("= "+MaestroA.rounder(temp,2)+" [ M W ]",x+dx1,y);
	    }
	    
	    else if(state.Pw[5]<1.0 && state.Pw[5]>=0.001){
		temp = state.Pw[5]*1000;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ m W ]",x+dx1,y);
	    }
	    else if(state.Pw[5]<0.001 && state.Pw[5]>=1.0E-6){
		temp = state.Pw[5]*1.0E6;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ \u00b5 W ]",x+dx1,y);
	    }
	    else if(state.Pw[5]<1.0E-6 && state.Pw[5]>=1.0E-9){
		temp = state.Pw[5]*1.0E9;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ n W ]",x+dx1,y);
	    }
	    else if(state.Pw[5]<1.0E-9 && state.Pw[5]>=1.0E-12){
		temp = state.Pw[5]*1.0E12;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ p W ]",x+dx1,y);
	    }
	    else if(state.Pw[5]<1.0E-12 && state.Pw[5]>=1.0E-15){
		temp = state.Pw[5]*1.0E15;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ f W ]",x+dx1,y);
	    }
	    else if(state.Pw[5]<1.0E-15 && state.Pw[5]>=1.0E-18){
		temp = state.Pw[5]*1.0E18;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ a W ]",x+dx1,y);
	    }
	    else if(state.Pw[5]<1.0E-18){
		temp = 0.0;
		g.drawString("= "+MaestroA.rounder(temp,6)+" [ W ]",x+dx1,y);
	    }
	    //g.drawString("P( Zg ) = "+MaestroA.rounder(state.Pw[5],4)+" [ W ]",x+dxx,y);
	    
	    y += dyy;
	    g.setColor(Color.red);
	    g.drawString("Total time-average power from the generator",x,y);
	    y += dy;
	    g.setColor(Color.black);
            
	    if(state.Pw[6]>=1.0 && state.Pw[6]<1.0E3 || state.Pw[6]==0.0){
		g.drawString("P( tot ) = P( abs ) + P( Zg ) = "+MaestroA.rounder(state.Pw[6],6)+" [ W ]",x,y);
	    }
	    else if(state.Pw[6]<1.0E6 && state.Pw[6]>=1.0E3){
		temp = state.Pw[6]*1.0E-3;
		g.drawString("P( tot ) = P( abs ) + P( Zg ) = "+MaestroA.rounder(temp,4)+" [ k W ]",x,y);
	    }
	    else if(state.Pw[6]>=1.0E6){
		temp = state.Pw[6]*1.0E-6;
		g.drawString("P( tot ) = P( abs ) + P( Zg ) = "+MaestroA.rounder(temp,2)+" [ M W ]",x,y);
	    }
	    else if(state.Pw[6]<1.0 && state.Pw[6]>=0.001){
		temp = state.Pw[6]*1000;
		g.drawString("P( tot ) = P( abs ) + P( Zg ) = "+MaestroA.rounder(temp,6)+" [ m W ]",x,y);
	    }
	    else if(state.Pw[6]<0.001 && state.Pw[6]>=1.0E-6){
		temp = state.Pw[6]*1.0E6;
		g.drawString("P( tot ) = P( abs ) + P( Zg ) = "+MaestroA.rounder(temp,6)+" [ \u00b5 W ]",x,y);
	    }
	    else if(state.Pw[6]<1.0E-6 && state.Pw[6]>=1.0E-9){
		temp = state.Pw[6]*1.0E9;
		g.drawString("P( tot ) = P( abs ) + P( Zg ) = "+MaestroA.rounder(temp,6)+" [ n W ]",x,y);
	    }
	    else if(state.Pw[6]<1.0E-9 && state.Pw[6]>=1.0E-12){
		temp = state.Pw[6]*1.0E12;
		g.drawString("P( tot ) = P( abs ) + P( Zg ) = "+MaestroA.rounder(temp,6)+" [ p W ]",x,y);
	    }
	    else if(state.Pw[6]<1.0E-12 && state.Pw[6]>=1.0E-15 ){
		temp = state.Pw[6]*1.0E15;
		g.drawString("P( tot ) = P( abs ) + P( Zg ) = "+MaestroA.rounder(temp,6)+" [ f W ]",x,y);
	    }
	    else if(state.Pw[6]<1.0E-15 && state.Pw[6]>=1.0E-18){
		temp = state.Pw[6]*1.0E18;
		g.drawString("P( tot ) = P( abs ) + P( Zg ) = "+MaestroA.rounder(temp,6)+" [ a W ]",x,y);
	    }
	    else if(state.Pw[6]<1.0E-18){
		temp = 0.0;
		g.drawString("P( tot ) = P( abs ) + P( Zg ) = "+MaestroA.rounder(temp,6)+" [ W ]",x,y);
	    }
	}
}

class StubOutputCanvas extends Canvas{
	private static final Font normalfont = new Font("SanSerif",Font.PLAIN,12);
	private static final Font symbolfont = new Font("Symbol",Font.PLAIN,12);
	private static final Font subfont    = new Font("SanSerif",Font.PLAIN,10);
	Trans_State state;
	public StubOutputCanvas(Trans_State state){
	    super();
	    this.state = state;
	}
	
	public void paint(Graphics g){
	    int x, y, dx, dy, dy2, dyy, dxx, dxxx;
	    int i;
	    FontMetrics fm;
	    String tmp;
	    x = 10;
	    y = 50;
	    dx = 40;
	    dxx = 15;
            dxxx = 210;
	    
	    fm = g.getFontMetrics();
	    dy = fm.getHeight();
            dy2 = dy + 2;
	    dyy = dy + 4;
	    g.clearRect(0,0,getSize().width,getSize().height);
	    
            g.setColor(new Color(120,120,120));
            g.drawLine(5,y-15,getSize().width-5,y-15);
            
            g.setColor(Color.blue.darker());
	    g.setFont(normalfont);
            g.drawString("1 )",x,y);
            MaestroG.subscripterSanSym2("Z","0"," = "+state.ZIMP[9]," \u03a9",g,11,dx,y);
            MaestroG.subscripter("\u03b5","r"," = "+state.eps_r[9],g,11,dxxx,y);
            MaestroG.subscripter("L","1"," = "+MaestroA.rounder(state.Section_length[9],6)+" \u03bb  = "+
                                  MaestroA.rounder(state.Section_length_meters[9],8)+" m",g,11,dx,y+dy2);
            
	    y+= dyy;
            
            g.setColor(Color.white);
	    g.drawLine(5,y+dyy/3,getSize().width-5,y+dyy/3);
            y += dyy;
	    
            g.setColor(Color.red.darker());
	    g.setFont(normalfont);
            g.drawString("2 )",x,y);
            MaestroG.subscripterSanSym2("Z","0"," = "+state.ZIMP[8]," \u03a9",g,11,dx,y);
            MaestroG.subscripter("\u03b5","r"," = "+state.eps_r[8],g,11,dxxx,y);
            MaestroG.subscripter("L","2"," = "+MaestroA.rounder(state.Section_length[8],6)+" \u03bb  = " +
                                 MaestroA.rounder(state.Section_length_meters[8],8)+" m",g,11,dx,y+dy2);
            
            
            y+= dyy;
            
            g.setColor(new Color(120,120,120));
	    g.drawLine(5,y+dyy/3,getSize().width-5,y+dyy/3);
            y += dyy;
	    
            g.setColor(Color.black);
	    g.setFont(normalfont);
            g.drawString("3 )",x,y);
            MaestroG.subscripterSanSym2("Z","0"," = "+state.ZIMP[7]," \u03a9",g,11,dx,y);
            MaestroG.subscripter("\u03b5","r"," = "+state.eps_r[7],g,11,dxxx,y);
            MaestroG.subscripter("L","3"," = "+MaestroA.rounder(state.Section_length[7],6)+" \u03bb  = " +
                                 MaestroA.rounder(state.Section_length_meters[7],8)+" m",g,11,dx,y+dy2);
            
            y+= dyy;
            
            g.setColor(Color.white);
	    g.drawLine(5,y+dyy/3,getSize().width-5,y+dyy/3);
            y += dyy;
	    
            g.setColor(Color.blue.darker());
	    g.setFont(normalfont);
            g.drawString("4 )",x,y);
            MaestroG.subscripterSanSym2("Z","0"," = "+state.ZIMP[6]," \u03a9",g,11,dx,y);
            MaestroG.subscripter("\u03b5","r"," = "+state.eps_r[6],g,11,dxxx,y);
            MaestroG.subscripter("L","4"," = "+MaestroA.rounder(state.Section_length[6],6)+" \u03bb  = " +
                                 MaestroA.rounder(state.Section_length_meters[6],8)+" m",g,11,dx,y+dy2);
            
            y+= dyy;
            
            g.setColor(new Color(120,120,120));
	    g.drawLine(5,y+dyy/3,getSize().width-5,y+dyy/3);
            y += dyy;
	    
	    g.setColor(Color.red.darker());
	    g.setFont(normalfont);
            g.drawString("5 )",x,y);
            MaestroG.subscripterSanSym2("Z","0"," = "+state.ZIMP[5]," \u03a9",g,11,dx,y);
            MaestroG.subscripter("\u03b5","r"," = "+state.eps_r[5],g,11,dxxx,y);
            MaestroG.subscripter("L","5"," = "+MaestroA.rounder(state.Section_length[5],6)+" \u03bb  = " +
                                 MaestroA.rounder(state.Section_length_meters[5],8)+" m",g,11,dx,y+dy2);
            
            y+= dyy;
            
            g.setColor(Color.white);
	    g.drawLine(5,y+dyy/3,getSize().width-5,y+dyy/3);
            y += dyy;
	    
	    g.setColor(Color.black);
	    g.setFont(normalfont);
            g.drawString("6 )",x,y);
            MaestroG.subscripterSanSym2("Z","0"," = "+state.ZIMP[4]," \u03a9",g,11,dx,y);
            MaestroG.subscripter("\u03b5","r"," = "+state.eps_r[4],g,11,dxxx,y);
            MaestroG.subscripter("L","6"," = "+MaestroA.rounder(state.Section_length[4],6)+" \u03bb  = " +
                                 MaestroA.rounder(state.Section_length_meters[4],8)+" m",g,11,dx,y+dy2);
            
            y+= dyy;
            
            g.setColor(new Color(120,120,120));
	    g.drawLine(5,y+dyy/3,getSize().width-5,y+dyy/3);
            y += dyy;
	    
            g.setColor(Color.blue.darker());
	    g.setFont(normalfont);
            g.drawString("7 )",x,y);
            MaestroG.subscripterSanSym2("Z","0"," = "+state.ZIMP[3]," \u03a9",g,11,dx,y);
            MaestroG.subscripter("\u03b5","r"," = "+state.eps_r[3],g,11,dxxx,y);
            MaestroG.subscripter("L","7"," = "+MaestroA.rounder(state.Section_length[3],6)+" \u03bb  = " +
                                 MaestroA.rounder(state.Section_length_meters[3],8)+" m",g,11,dx,y+dy2);
            
            y+= dyy;
            
            g.setColor(Color.white);
	    g.drawLine(5,y+dyy/3,getSize().width-5,y+dyy/3);
            y += dyy;
	    
            g.setColor(Color.red.darker());
	    g.setFont(normalfont);
            g.drawString("8 )",x,y);
            MaestroG.subscripterSanSym2("Z","0"," = "+state.ZIMP[2]," \u03a9",g,11,dx,y);
            MaestroG.subscripter("\u03b5","r"," = "+state.eps_r[2],g,11,dxxx,y);
            MaestroG.subscripter("L","8"," = "+MaestroA.rounder(state.Section_length[2],6)+" \u03bb  = " +
                                 MaestroA.rounder(state.Section_length_meters[2],8)+" m",g,11,dx,y+dy2);
            
            y+= dyy;
            
            g.setColor(new Color(120,120,120));
	    g.drawLine(5,y+dyy/3,getSize().width-5,y+dyy/3);
            y += dyy;
	    
            g.setColor(Color.black);
	    g.setFont(normalfont);
            g.drawString("9 )",x,y);
            MaestroG.subscripterSanSym2("Z","0"," = "+state.ZIMP[1]," \u03a9",g,11,dx,y);
            MaestroG.subscripter("\u03b5","r"," = "+state.eps_r[1],g,11,dxxx,y);
            MaestroG.subscripter("L","9"," = "+MaestroA.rounder(state.Section_length[1],6)+" \u03bb  = " +
                                 MaestroA.rounder(state.Section_length_meters[1],8)+" m",g,11,dx,y+dy2);
            
            y+= dyy;
            
            g.setColor(Color.white);
	    g.drawLine(5,y+dyy/3,getSize().width-5,y+dyy/3);
            y += dyy;
	    
            g.setColor(Color.blue.darker());
	    g.setFont(normalfont);
            g.drawString("10 )",x,y);
            MaestroG.subscripterSanSym2("Z","0"," = "+state.ZIMP[0]," \u03a9",g,11,dx,y);
            MaestroG.subscripter("\u03b5","r"," = "+state.eps_r[0],g,11,dxxx,y);
            MaestroG.subscripter("L","10"," = "+MaestroA.rounder(state.Section_length[0],6)+" \u03bb  = " +
                                 MaestroA.rounder(state.Section_length_meters[0],8)+" m",g,11,dx,y+dy2);
            
            y+= dyy;
            g.setColor(new Color(120,120,120));
            g.drawLine(5,y+dyy/3,getSize().width-5,y+dyy/3);
            
            
            
            
	}
}
