//PlaneWaveOutputPanel.java
import java.awt.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.imageio.ImageIO;

public class PlaneWaveOutputPanel extends Panel implements ItemListener{
	PlaneWave_State state;
	//private static final Color bgcolor = Color.lightGray;
	private static final Color bgcolor = new Color(236,236,236);
	private Font labfont;
	private Font symbolfont;
	private Font titlefont;
	Label titlelabel;	
	public Choice c1;
	public PlaneWaveOutputCanvasA pwocA; 
	public PlaneWaveOutputCanvasB pwocB;
        
	public PlaneWaveOutputPanel(PlaneWave_State state){
	    super();
	    setLayout(null);
            this.state = state;
	    setBackground(bgcolor);
            
            labfont = new Font("SanSerif",Font.PLAIN,state.font11);
            symbolfont = new Font("Serif",Font.PLAIN,state.font11);
            titlefont = new Font("SanSerif",Font.BOLD,state.font16);
	
	    titlelabel = new Label("Output Data");
	    //add(titlelabel);
	    //titlelabel.setBounds(5,5,300,40);    
	    titlelabel.setFont(titlefont);
	    
	    c1 = new Choice();
	    c1.addItem("   Wave Properties   ");
	    c1.addItem("   Power Flow   ");
	    add(c1);
	    c1.setBounds(state.s100,state.s5,state.s175,state.s20);
	    c1.setFont(new Font("SanSerif",Font.ITALIC,state.font11));
            
	    pwocA = new PlaneWaveOutputCanvasA(state);
	    add(pwocA);
	    pwocA.setBounds(state.s5,0,state.s200+state.s80,state.s200+state.s75);
	    
            pwocB = new PlaneWaveOutputCanvasB(state);
	    add(pwocB);
	    pwocB.setBounds(state.s5,0,state.s200+state.s80,state.s200+state.s75);
	    
	    pwocA.setVisible(true);
	    pwocB.setVisible(false);
            
	    //Listeners
	    c1.addItemListener(this);
	}

    public void itemStateChanged(ItemEvent evt){
	ItemSelectable ie = evt.getItemSelectable();
	    if(evt.getSource()==c1){
		if(ie.getSelectedObjects()[0]=="   Wave Properties   "){
		    pwocA.setVisible(true);
		    pwocB.setVisible(false);
		}
		else if(ie.getSelectedObjects()[0]=="   Power Flow   "){
		    pwocA.setVisible(false);
		    pwocB.setVisible(true);
		}
	    }
    }	
    }//PlaneWaveOutputPanel.java

    class PlaneWaveOutputCanvasA extends Canvas{
	private Font normalfont;
	private Font symbolfont;
	private Font subfont;
	PlaneWave_State state;
	private Image im;
	private Graphics buf;
    
    private BufferedImage angle_img;
    private BufferedImage infinity;

	public PlaneWaveOutputCanvasA(PlaneWave_State state){
	    super();
	    this.state = state;
	    getImages();
	}

    private void getImages() {
        // read in the nabla images, because CHEERPJ does not render this
	//  symbol in any font!  (java to javascript converter)
        try {
            //angle_img = ImageIO.read(getClass().getResource("angle.png"));
	    BufferedImage img =
		ImageIO.read(getClass().getResource("angle.png"));
	    int targetWidth = (int) (state.sfactor * img.getWidth());
	    int targetHeight = (int) (state.sfactor * img.getHeight());
	    angle_img =
		new BufferedImage(targetWidth, targetHeight, BufferedImage.TYPE_INT_RGB);

	    Graphics2D graphics2D = angle_img.createGraphics();

	    graphics2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
					RenderingHints.VALUE_INTERPOLATION_BILINEAR);
	    graphics2D.drawImage(img, 0, 0, targetWidth, targetHeight, 0, 0,
				 img.getWidth(), img.getHeight(), null);
	    graphics2D.dispose();

	    img =
		ImageIO.read(getClass().getResource("infinity.png"));
	    targetWidth = (int) ((state.sfactor*1.2) * img.getWidth());
	    targetHeight = (int) ((state.sfactor*1.2) * img.getHeight());
	    infinity =
		new BufferedImage(targetWidth, targetHeight, BufferedImage.TYPE_INT_RGB);
	    graphics2D = infinity.createGraphics();

	    graphics2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
					RenderingHints.VALUE_INTERPOLATION_BILINEAR);
	    graphics2D.drawImage(img, 0, 0, targetWidth, targetHeight, 0, 0,
				 img.getWidth(), img.getHeight(), null);
	    graphics2D.dispose();
	    
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
	
	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){
	    normalfont = new Font("SanSerif",Font.PLAIN,state.font11);
            symbolfont = new Font("Serif",Font.PLAIN,state.font13);
            subfont    = new Font("SanSerif",Font.PLAIN,state.font10);
	
            int x, y, dx, dxx, dy, dyy;
	    double v_normalized;
	    FontMetrics fm;
	    double temp, temp2;
	    int fonto = state.font11;
            int fonto_delta = state.font12;
	    
            Graphics2D g2d = (Graphics2D)g;
            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
            
            x = state.s20;
	    y = state.s40;
	    dx = state.s90;
	    dxx = state.s15;
	    
	    
	    g.setFont(normalfont);
	    fm = g.getFontMetrics();
	    dy = fm.getHeight();
	    dyy = dy + state.s3;
	    g.clearRect(0,0,getSize().width,getSize().height);
	    g.setColor(Color.red.darker());
	    g.drawString("WaveLength",x,y);	
	    
            int startx = state.s12;
            
            //g.setColor(Color.gray);
            //MaestroG.subscripterBold("Output","","",g,state.font14,startx+state.s1,startx+state.s6);
            g.setColor(Color.red.darker());
            MaestroG.subscripterBold("Output","","",g,state.font14,startx,startx+state.s5);
            
            g.setColor(Color.black);
	    temp2 = state.wavelength;
	    g.setFont(symbolfont);
	    g.drawString("\u03bb",x+dx,y);
	    g.setFont(normalfont);	
	    
		    if(state.frequency == 0.0){		
			g.drawString("  =        [ m ]",x+dx+state.s10,y);
			g.setFont(symbolfont);
			//g.drawString("\u221e",x+dx+fm.stringWidth("  =   "),y);
			g.drawImage(infinity,x+dx+fm.stringWidth("  =   "),
				    y-infinity.getHeight(),this);
			
			g.setFont(normalfont);
		    }
		    else if(temp2 >= 1.0E15 && state.frequency > 0.0){
			temp = temp2;
			MaestroG.superscripter("  =  "+temp+"   [ m ]","","",g,fonto,x+dx+state.s10,y); 
		    }
		    else if(temp2 < 1.0e15 && temp2 >= 1.0E12){
			temp = temp2/1.0E12;
			MaestroG.superscripter("  =  "+MaestroA.rounder(temp,5)+"   [ 10","9"," km ]",g,fonto,x+dx+state.s10,y); 
		    }
		    else if(temp2 < 1.0e12 && temp2 >= 1.0e9){
			temp = temp2/1.0E9;
			MaestroG.superscripter("  =  "+MaestroA.rounder(temp,5)+"   [ 10","6"," km ]",g,fonto,x+dx+state.s10,y);   
			//g.drawString("  =  "+MaestroA.rounder(temp,8)+"   [ Gm ]",x+dx+10,y); 
		    }
		    else if(temp2 < 1.0e9 && temp2 >= 1.0e6){
			temp = temp2/1.0E6; 
			MaestroG.superscripter("  =  "+MaestroA.rounder(temp,5)+"   [ 10","3"," km ]",g,fonto,x+dx+state.s10,y);  
			//g.drawString("  =  "+MaestroA.rounder(temp,8)+"   [ Mm ]",x+dx+10,y); 
		    }
		    else if(temp2 < 1.0E6 && temp2 >= 1.0E3){
			temp = temp2/1.0E3;
			g.drawString("  =  "+MaestroA.rounder(temp,5)+"   [ km ]",x+dx+state.s10,y); 
		    }
		    else if(temp2 < 1.0E3 && temp2 >= 1.0){
			g.drawString("  =  "+MaestroA.rounder(temp2,5)+"   [ m ]",x+dx+state.s10,y); 
		    }
		    else if(temp2 <1.0 && temp2 >= 1.0E-2){
			temp = temp2*1.0E2;
			g.drawString("  =  "+MaestroA.rounder(temp,5)+"   [ cm ]",x+dx+state.s10,y); 
		    }
		    else if(temp2 <1.0E-2 && temp2 >= 1.0E-4){
			temp = temp2*1.0E3;
			g.drawString("  =  "+MaestroA.rounder(temp,5)+"   [ mm ]",x+dx+state.s10,y); 
		    }
		    else if(temp2 < 1.0E-4 && temp2 >=1.0E-6 ){
			temp = temp2*1.0E6;
			g.drawString("  =  "+MaestroA.rounder(temp,5)+"   [ \u00b5 m ]",x+dx+state.s10,y); 
		    }
		    else if(temp2 < 1.0E-6 && temp2 >=1.0E-9){
			temp = temp2*1.0E9;
			g.drawString("  =  "+MaestroA.rounder(temp,5)+"   [ nm ]",x+dx+state.s10,y); 
		    }	
		    else if(temp2 < 1.0E-9 && temp2 >=1.0E-12){
			temp = temp2*1.0E12;
			MaestroG.superscripter("  =  "+MaestroA.rounder(temp,5)+"   [ 10","-12","  m ]",g,fonto,x+dx+state.s10,y); 
		    }	   
		    else if(temp2 < 1.0E-12 && temp2 >=1.0E-15){
			temp = temp2*1.0E15;
			MaestroG.superscripter("  =  "+MaestroA.rounder(temp,5)+"   [ 10","-15","  m ]",g,fonto,x+dx+state.s10,y);  
		    }
		    else if(temp2 < 1.0E-15 && temp2 >=1.0e-18){
			temp = temp2*1.0E18;
			MaestroG.superscripter("  =  "+MaestroA.rounder(temp,5)+"   [ 10","-18","  m ]",g,fonto,x+dx+state.s10,y);  
		    }
		    else if(temp2 < 1.0E-18 && temp2 >=1.0E-21){
			temp = temp2*1.0E21;
			MaestroG.superscripter("  =  "+MaestroA.rounder(temp,5)+"   [ 10","-21","  m ]",g,fonto,x+dx+state.s10,y);  
		    }
		    else if(temp2 < 1.0E-21 && temp2 > 0.0){
			temp = temp2;
			MaestroG.superscripter("  =  "+temp+" [m]","","",g,fonto,x+dx+state.s10,y);   
		    }
			       
		    else if(temp2 == 0.0){
			g.drawString("  =  "+MaestroA.rounder(temp2,8)+"   [ m ]",x+dx+state.s10,y); 
		    }   

	    //g.drawLine(state.s5,y,getSize().width-state.s5,y); 
	    y += dyy;
	    g.setColor(Color.red.darker());
	    g.drawString("Phase Velocity",x,y);
	    g.setColor(Color.black);
	    //y+= dy;
	    if(state.phase_velocity >= 1.0e8){
		v_normalized = state.phase_velocity/1.0E8;
		MaestroG.subsupspecial("u","p","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","8"," [ m / s ]",g,fonto,x+dx,y);
	    }
	    else if(state.phase_velocity >= 1.0e7 && state.phase_velocity < 1.0e8){
		v_normalized = state.phase_velocity/1.0E7;
		MaestroG.subsupspecial("u","p","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","7"," [ m / s ]",g,fonto,x+dx,y);
	    }
	    else if(state.phase_velocity >= 1.0e6 && state.phase_velocity < 1.0e7){
		v_normalized = state.phase_velocity/1.0E6;
		MaestroG.subsupspecial("u","p","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","6"," [ m / s ]",g,fonto,x+dx,y);
	    }
	    else if(state.phase_velocity >= 1.0e5 && state.phase_velocity < 1.0e6){
		v_normalized = state.phase_velocity/1.0E5;
		MaestroG.subsupspecial("u","p","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","5"," [ m / s ]",g,fonto,x+dx,y);
	    }
	    else if(state.phase_velocity >= 1.0e4 && state.phase_velocity < 1.0e5){
		v_normalized = state.phase_velocity/1.0E4;
		MaestroG.subsupspecial("u","p","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","4"," [ m / s ]",g,fonto,x+dx,y);
	    }
	    else if(state.phase_velocity >= 1.0e3 && state.phase_velocity < 1.0e4){
		v_normalized = state.phase_velocity/1.0E3;
		MaestroG.subsupspecial("u","p","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","3"," [ m / s ]",g,fonto,x+dx,y);
	    }
	    else if(state.phase_velocity >= 1.0e2 && state.phase_velocity < 1.0e3){
		v_normalized = state.phase_velocity/1.0E2;
		MaestroG.subsupspecial("u","p","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","2"," [ m / s ]",g,fonto,x+dx,y);
	    }
	    //else if(state.phase_velocity >= 1.0e1 && state.phase_velocity < 1.0e2){
		//v_normalized = state.phase_velocity/10.0;
		//MaestroG.subsupspecial("u","p","  =  "+MaestroA.rounder(v_normalized,5)+" x 10",""," [ m / s ]",g,fonto,x+dx,y);
		////g.drawString("Vp  =  "+MaestroA.rounder(v_normalized,5)+"   [ 1.0 E+1  m / s ]",x+dxx,y);
	    //}
	    else if(state.phase_velocity >= 1.0 && state.phase_velocity < 1.0e2){
		v_normalized = state.phase_velocity;
		MaestroG.subsupspecial("u","p","  =  "+MaestroA.rounder(v_normalized,5)+"",""," [ m / s ]",g,fonto,x+dx,y);
	    }
	    else if(state.phase_velocity >= 1.0e-1 && state.phase_velocity < 1.0){
		v_normalized = state.phase_velocity*10.0;
		MaestroG.subsupspecial("u","p","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","-1"," [ m / s ]",g,fonto,x+dx,y);
	    }
	    else if(state.phase_velocity >= 1.0e-2 && state.phase_velocity < 1.0e-1){
		v_normalized = state.phase_velocity*1.0e2;
		MaestroG.subsupspecial("u","p","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","-2"," [ m / s ]",g,fonto,x+dx,y);
	    }
	    else if(state.phase_velocity >= 1.0e-3 && state.phase_velocity < 1.0e-2){
		v_normalized = state.phase_velocity*1.0e3;
		MaestroG.subsupspecial("u","p","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","-3"," [ m / s ]",g,fonto,x+dx,y);
	    }
	    else if(state.phase_velocity >= 1.0e-4 && state.phase_velocity < 1.0e-3){
		v_normalized = state.phase_velocity*1.0e4;
		MaestroG.subsupspecial("u","p","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","-4"," [ m / s ]",g,fonto,x+dx,y);
	    }
	    else if(state.phase_velocity >= 1.0e-5 && state.phase_velocity < 1.0e-4){
		v_normalized = state.phase_velocity*1.0e5;
		MaestroG.subsupspecial("u","p","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","-5"," [ m / s ]",g,fonto,x+dx,y);
	    }
	    else if(state.phase_velocity >= 1.0e-6 && state.phase_velocity < 1.0e-5){
		v_normalized = state.phase_velocity*1.0e6;
		MaestroG.subsupspecial("u","p","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","-6"," [ m / s ]",g,fonto,x+dx,y);
	    }
	    else if(state.phase_velocity >= 1.0e-7 && state.phase_velocity < 1.0e-6){
		v_normalized = state.phase_velocity*1.0e7;
		MaestroG.subsupspecial("u","p","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","-7"," [ m / s ]",g,fonto,x+dx,y);
	    }
	    else if(state.phase_velocity >= 1.0e-8 && state.phase_velocity < 1.0e-7){
		v_normalized = state.phase_velocity*1.0e8;
		MaestroG.subsupspecial("u","p","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","-8"," [ m / s ]",g,fonto,x+dx,y);
	    }
	    else if(state.phase_velocity >= 1.0e-9 && state.phase_velocity < 1.0e-8){
		v_normalized = state.phase_velocity*1.0e9;
		MaestroG.subsupspecial("u","p","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","-9"," [ m / s ]",g,fonto,x+dx,y);
	    }
	    else if(state.phase_velocity < 1.0e-9){
		v_normalized = state.phase_velocity*1.0e10;
		MaestroG.subsupspecial("u","p","  =  "+v_normalized+" x 10","-10"," [ m / s ]",g,fonto,x+dx,y);
	    }
            //----------------------------------------- Period
            dx = dx + state.s3;
            y += dyy + state.s2;
	    g.setColor(Color.red.darker());
	    g.drawString("Period",x,y);
	    g.setColor(Color.black);
	    //y+= dy;
            
	    if(state.period >= 1.0e8){
		v_normalized = state.period/1.0E8;
		MaestroG.subsupspecial2("T","","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","8"," [ s ]",g,fonto,x+dx,y);
	    }
	    else if(state.period >= 1.0e7 && state.period < 1.0e8){
		v_normalized = state.period/1.0E7;
		MaestroG.subsupspecial2("T","","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","7"," [ s ]",g,fonto,x+dx,y);
	    }
	    else if(state.period >= 1.0e6 && state.period < 1.0e7){
		v_normalized = state.period/1.0E6;
		MaestroG.subsupspecial2("T","","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","6"," [ s ]",g,fonto,x+dx,y);
	    }
	    else if(state.period >= 1.0e5 && state.period < 1.0e6){
		v_normalized = state.period/1.0E5;
		MaestroG.subsupspecial2("T","","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","5"," [ s ]",g,fonto,x+dx,y);
	    }
	    else if(state.period >= 1.0e4 && state.period < 1.0e5){
		v_normalized = state.period/1.0E4;
		MaestroG.subsupspecial2("T","","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","4"," [ s ]",g,fonto,x+dx,y);
	    }
	    else if(state.period >= 1.0e3 && state.period < 1.0e4){
		v_normalized = state.period/1.0E3;
		MaestroG.subsupspecial2("T","","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","3"," [ s ]",g,fonto,x+dx,y);
	    }
	    else if(state.period >= 1.0e2 && state.period < 1.0e3){
		v_normalized = state.period/1.0E2;
		MaestroG.subsupspecial2("T","","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","2"," [ s ]",g,fonto,x+dx,y);
	    }
	    //else if(state.period >= 1.0e1 && state.period < 1.0e2){
		//v_normalized = state.period/10.0;
		//MaestroG.subsupspecial2("T","","  =  "+MaestroA.rounder(v_normalized,5)+" x 10",""," [ s ]",g,fonto,x+dx,y);	
	    //}
	    else if(state.period >= 1.0 && state.period < 1.0e2){
		v_normalized = state.period;
		MaestroG.subsupspecial2("T","","  =  "+MaestroA.rounder(v_normalized,5)+"",""," [ s ]",g,fonto,x+dx,y);
	    }
	    else if(state.period >= 1.0e-1 && state.period < 1.0){
		v_normalized = state.period*10.0;
		MaestroG.subsupspecial2("T","","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","-1"," [ s ]",g,fonto,x+dx,y);
	    }
	    else if(state.period >= 1.0e-2 && state.period < 1.0e-1){
		v_normalized = state.period*1.0e2;
		MaestroG.subsupspecial2("T","","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","-2"," [ s ]",g,fonto,x+dx,y);
	    }
	    else if(state.period >= 1.0e-3 && state.period < 1.0e-2){
		v_normalized = state.period*1.0e3;
		MaestroG.subsupspecial2("T","","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","-3"," [ s ]",g,fonto,x+dx,y);
	    }
	    else if(state.period >= 1.0e-4 && state.period < 1.0e-3){
		v_normalized = state.period*1.0e4;
		MaestroG.subsupspecial2("T","","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","-4"," [ s ]",g,fonto,x+dx,y);
	    }
	    else if(state.period >= 1.0e-5 && state.period < 1.0e-4){
		v_normalized = state.period*1.0e5;
		MaestroG.subsupspecial2("T","","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","-5"," [ s ]",g,fonto,x+dx,y);
	    }
	    else if(state.period >= 1.0e-6 && state.period < 1.0e-5){
		v_normalized = state.period*1.0e6;
		MaestroG.subsupspecial2("T","","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","-6"," [ s ]",g,fonto,x+dx,y);
	    }
	    else if(state.period >= 1.0e-7 && state.period < 1.0e-6){
		v_normalized = state.period*1.0e7;
		MaestroG.subsupspecial2("T","","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","-7"," [ s ]",g,fonto,x+dx,y);
	    }
	    else if(state.period >= 1.0e-8 && state.period < 1.0e-7){
		v_normalized = state.period*1.0e8;
		MaestroG.subsupspecial2("T","","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","-8"," [ s ]",g,fonto,x+dx,y);
	    }
	    else if(state.period >= 1.0e-9 && state.period < 1.0e-8){
		v_normalized = state.period*1.0e9;
		MaestroG.subsupspecial2("T","","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","-9"," [ s ]",g,fonto,x+dx,y);
	    }
	    else if(state.period >= 1.0e-10 && state.period < 1.0e-9){
		v_normalized = state.period*1.0e10;
		MaestroG.subsupspecial2("T","","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","-10"," [ s ]",g,fonto,x+dx,y);
	    }
            else if(state.period >= 1.0e-11 && state.period < 1.0e-10){
		v_normalized = state.period*1.0e11;
		MaestroG.subsupspecial2("T","","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","-11"," [ s ]",g,fonto,x+dx,y);
	    }
            else if(state.period >= 1.0e-12 && state.period < 1.0e-11){
		v_normalized = state.period*1.0e12;
		MaestroG.subsupspecial2("T","","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","-12"," [ s ]",g,fonto,x+dx,y);
	    }
            else if(state.period >= 1.0e-13 && state.period < 1.0e-12){
		v_normalized = state.period*1.0e13;
		MaestroG.subsupspecial2("T","","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","-13"," [ s ]",g,fonto,x+dx,y);
	    }
            else if(state.period >= 1.0e-14 && state.period < 1.0e-13){
		v_normalized = state.period*1.0e14;
		MaestroG.subsupspecial2("T","","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","-14"," [ s ]",g,fonto,x+dx,y);
	    }
            else if(state.period >= 1.0e-15 && state.period < 1.0e-14){
		v_normalized = state.period*1.0e15;
		MaestroG.subsupspecial2("T","","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","-15"," [ s ]",g,fonto,x+dx,y);
	    }
            else if(state.period >= 1.0e-16 && state.period < 1.0e-15){
		v_normalized = state.period*1.0e16;
		MaestroG.subsupspecial2("T","","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","-16"," [ s ]",g,fonto,x+dx,y);
	    }
            else if(state.period >= 1.0e-17 && state.period < 1.0e-16){
		v_normalized = state.period*1.0e17;
		MaestroG.subsupspecial2("T","","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","-17"," [ s ]",g,fonto,x+dx,y);
	    }
            else if(state.period >= 1.0e-18 && state.period < 1.0e-17){
		v_normalized = state.period*1.0e18;
		MaestroG.subsupspecial2("T","","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","-18"," [ s ]",g,fonto,x+dx,y);
	    }
            else if(state.period >= 1.0e-19 && state.period < 1.0e-18){
		v_normalized = state.period*1.0e19;
		MaestroG.subsupspecial2("T","","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","-19"," [ s ]",g,fonto,x+dx,y);
	    }
            else if(state.period >= 1.0e-20 && state.period < 1.0e-19){
		v_normalized = state.period*1.0e20;
		MaestroG.subsupspecial2("T","","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","-20"," [ s ]",g,fonto,x+dx,y);
	    }
            else if(state.period >= 1.0e-21 && state.period < 1.0e-20){
		v_normalized = state.period*1.0e21;
		MaestroG.subsupspecial2("T","","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","-21"," [ s ]",g,fonto,x+dx,y);
	    }
            else if(state.period >= 1.0e-22 && state.period < 1.0e-21){
		v_normalized = state.period*1.0e22;
		MaestroG.subsupspecial2("T","","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","-22"," [ s ]",g,fonto,x+dx,y);
	    }
            else if(state.period >= 1.0e-23 && state.period < 1.0e-22){
		v_normalized = state.period*1.0e23;
		MaestroG.subsupspecial2("T","","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","-23"," [ s ]",g,fonto,x+dx,y);
	    }
            else if(state.period >= 1.0e-24 && state.period < 1.0e-23){
		v_normalized = state.period*1.0e24;
		MaestroG.subsupspecial2("T","","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","-24"," [ s ]",g,fonto,x+dx,y);
	    }
            else if(state.period < 1.0e-24){
		v_normalized = state.period*1.0e25;
		MaestroG.subsupspecial2("T","","  =  "+MaestroA.rounder(v_normalized,5)+" x 10","-25"," [ s ]",g,fonto,x+dx,y);
	    }
            //------------------------------------------------
            dx = dx - state.s3;
	    //g.drawLine(5,y,getSize().width-5,y); 
	    g.setColor(Color.red.darker());
	    y += dyy;
	    g.drawString("Impedance of the Medium  [     ]", x, y);
	    g.setFont(symbolfont);
	    g.drawString("\u03a9",x+fm.stringWidth("Impedance of the Medium  [ "),y);
	    g.setFont(normalfont);	
	    y+= dy;
	    g.setColor(Color.black);
	    
	    g.setFont(symbolfont);
	    g.drawString("\u03b7",x+dxx,y);
	    g.setFont(normalfont);	
	    
	    //g.drawString(" =  "+state.wave_impedance.toString(Complex.CARTESIAN,6),x+dxx+10,y);
	    //y+= dy;
	    //g.drawString(" =  "+state.wave_impedance.toString(Complex.POLAR_RADIAN,6),x+dxx+10,y);
	    //y+= dy;
	    //g.drawString(" =  "+state.wave_impedance.toString(Complex.POLAR_DEGREE,6),x+dxx+10,y);
	    
            //----------------------------------------------------------------------------------
            
            //MaestroG.SansNosansSymb2("",""," [ "+Ohm+" ]",g,10,x,y+dy);
                int xinit2, xinit3, stepx;
                double tempR, tempX;
                
                String alpha, Ohm, lambda, infinity, Gamma, plusj, minusj, 
                       sign, plusr, minusr, signr;
		
                plusj =" + j ";
		minusj=" - j ";
                plusr ="";
                minusr =" - ";
            
                xinit2 = x+dxx+state.s10;
                
                    tempR=0.0; tempX=0.0;
                    stepx = 0;
                    
		    if(Complex.Imaginary(state.wave_impedance) >= 0.0){sign = plusj;}
		    else{sign = minusj;}
		    
                    tempR = state.wave_impedance.Real();
		    
		    if(tempR < 1.0E3 && tempR >= 1.0E-3){
			MaestroG.superscripter("  = "+MaestroA.rounder(tempR,6),"","",g,fonto,xinit2,y);
			stepx = fm.stringWidth("  = "+MaestroA.rounder(tempR,6));
		    }
		    else if(tempR == 0.0){
			MaestroG.superscripter("  = 0.0","","",g,fonto,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,fonto,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,fonto,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,fonto,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,fonto,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,fonto,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,fonto,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,fonto,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,fonto,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,fonto,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,fonto,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,fonto,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,fonto,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,fonto,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,fonto,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,fonto,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,fonto,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,fonto,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,fonto,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,fonto,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,fonto,xinit2,y);
			stepx = fm.stringWidth("  = 0.0");
		    }
		    
		    tempX = Math.abs(state.wave_impedance.Imaginary());
		    xinit3 = xinit2+stepx;
		    
		    if(tempX < 1.0E3 && tempX >= 1.0E-3){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX,6),"","",g,fonto,xinit3,y);
		    }
		    else if(tempX == 0.0){
			MaestroG.superscripter(" + j 0.0","","",g,fonto,xinit3,y);
		    }
		    else if(tempX < 1.0E6 && tempX >= 1.0E3){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-3,2)+" x 10","3","",g,fonto,xinit3,y);
		    }
		    else if(tempX < 1.0E9 && tempX >= 1.0E6){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-6,2)+" x 10","6","",g,fonto,xinit3,y);
		    }
		    else if(tempX < 1.0E12 && tempX >= 1.0E9){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-9,2)+" x 10","9","",g,fonto,xinit3,y);
		    }
		    else if(tempX < 1.0E15 && tempX >= 1.0E12){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-12,2)+" x 10","12","",g,fonto,xinit3,y);
		    }
		    else if(tempX < 1.0E18 && tempX >= 1.0E15){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-15,2)+" x 10","15","",g,fonto,xinit3,y);
		    }
		    else if(tempX < 1.0E21 && tempX >= 1.0E18){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-18,2)+" x 10","18","",g,fonto,xinit3,y);
		    }
		    else if(tempX < 1.0E24 && tempX >= 1.0E21){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-21,2)+" x 10","21","",g,fonto,xinit3,y);
		    }
		    else if(tempX < 1.0E27 && tempX >= 1.0E24){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-24,2)+" x 10","24","",g,fonto,xinit3,y);
		    }
		    else if(tempX < 1.0E30 && tempX >= 1.0E27){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-27,2)+" x 10","27","",g,fonto,xinit3,y);
		    }
		    else if(tempX >= 1.0E30){
			MaestroG.superscripter(sign+""+MaestroA.rounder(tempX*1.0E-30,2)+" x 10","30","",g,fonto,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,fonto,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,fonto,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,fonto,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,fonto,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,fonto,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,fonto,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,fonto,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,fonto,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,fonto,xinit3,y);
		    }
                    else if(tempX < 1.0E-30 && tempX != 0.0){
			MaestroG.superscripter(sign+" 0.0","","",g,fonto,xinit3,y);
		    }
                
                    y += dy;
           	    
		    tempR = Complex.Magnitude(state.wave_impedance);
                    double dtmp2;
     
                    if(tempR == 0.0){dtmp2 = 0.0;}
                    else{dtmp2=MaestroA.rounder(state.wave_impedance.Arg2(),4);}
		    if(tempR < 1.0E3 && tempR >= 1.0E-3){
                        //MaestroG.SansMiditalic("  = "+MaestroA.rounder(tempR,6),"  \u2220 ",""+dtmp2+" rad",g,fonto,xinit2,y);
			MaestroG.TxtImgTxt("  = "+MaestroA.rounder(tempR,6),angle_img,""+dtmp2+" rad",g,fonto,xinit2,y,this);
		    }
		    else if(tempR == 0.0){
			//MaestroG.SansMiditalic("  = 0.0","  \u2220 ",""+dtmp2+" rad",g,fonto,xinit2,y);
			MaestroG.TxtImgTxt("  = 0.0",angle_img,""+dtmp2+" rad",g,fonto,xinit2,y,this);
		    }
		    else if(tempR < 1.0E6 && tempR >= 1.0E3){
                        //MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E-3,2)+" x 10","3","  \u2220 ",""+dtmp2+" rad",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E-3,2)+" x 10","3",angle_img,
						""+dtmp2+" rad",g,fonto,xinit2,y,this);
		    }
		    else if(tempR < 1.0E9 && tempR >= 1.0E6){
			//MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E-6,2)+" x 10","6","  \u2220 ",""+dtmp2+" rad",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E-6,2)+" x 10","6",angle_img,
						""+dtmp2+" rad",g,fonto,xinit2,y,this);
		    }
		    else if(tempR < 1.0E12 && tempR >= 1.0E9){
			//MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E-9,2)+" x 10","9","  \u2220 ",""+dtmp2+" rad",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E-9,2)+" x 10","9",angle_img,
						""+dtmp2+" rad",g,fonto,xinit2,y,this);
		    }
		    else if(tempR < 1.0E15 && tempR >= 1.0E12){
			//MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E-12,2)+" x 10","12","  \u2220 ",""+dtmp2+" rad",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E-12,2)+" x 10","12",angle_img,
						""+dtmp2+" rad",g,fonto,xinit2,y,this);
		    }
		    else if(tempR < 1.0E18 && tempR >= 1.0E15){
			//MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E-15,2)+" x 10","15","  \u2220 ",""+dtmp2+" rad",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E-15,2)+" x 10","15",angle_img,
						""+dtmp2+" rad",g,fonto,xinit2,y,this);
		    }
		    else if(tempR < 1.0E21 && tempR >= 1.0E18){
			//MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E-18,2)+" x 10","18","  \u2220 ",""+dtmp2+" rad",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E-18,2)+" x 10","18",angle_img,
						""+dtmp2+" rad",g,fonto,xinit2,y,this);
		    }
		    else if(tempR < 1.0E24 && tempR >= 1.0E21){
			//MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E-21,2)+" x 10","21","  \u2220 ",""+dtmp2+" rad",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E-21,2)+" x 10","21",angle_img,
						""+dtmp2+" rad",g,fonto,xinit2,y,this);
		    }
		    else if(tempR < 1.0E27 && tempR >= 1.0E24){
			//MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E-24,2)+" x 10","24","  \u2220 ",""+dtmp2+" rad",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E-24,2)+" x 10","24",angle_img,
						""+dtmp2+" rad",g,fonto,xinit2,y,this);
		    }
		    else if(tempR < 1.0E30 && tempR >= 1.0E27){
			//MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E-27,2)+" x 10","27","  \u2220 ",""+dtmp2+" rad",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E-27,2)+" x 10","27",angle_img,
						""+dtmp2+" rad",g,fonto,xinit2,y,this);
		    }
		    else if(tempR >= 1.0E30){
			//MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E-30,2)+" x 10","30","  \u2220 ",""+dtmp2+" rad",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E-30,2)+" x 10","30",angle_img,
						""+dtmp2+" rad",g,fonto,xinit2,y,this);
		    }
		    else if(tempR < 1.0E-3 && tempR >= 1.0E-6){
			//MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E6,2)+" x 10","-6","  \u2220 ",""+dtmp2+" rad",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E6,2)+" x 10","-6",angle_img,
						""+dtmp2+" rad",g,fonto,xinit2,y,this);
		    }
		    else if(tempR < 1.0E-6 && tempR >= 1.0E-9){
			//MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E9,2)+" x 10","-9","  \u2220 ",""+dtmp2+" rad",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E9,2)+" x 10","-9",angle_img,
						""+dtmp2+" rad",g,fonto,xinit2,y,this);
		    }
		    else if(tempR < 1.0E-9 && tempR >= 1.0E-12){
			//MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E12,2)+" x 10","-12","  \u2220 ",""+dtmp2+" rad",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E12,2)+" x 10","-12",angle_img,
						""+dtmp2+" rad",g,fonto,xinit2,y,this);
		    }
		    else if(tempR < 1.0E-12 && tempR >= 1.0E-15){
			//MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E15,2)+" x 10","-15","  \u2220 ",""+dtmp2+" rad",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E15,2)+" x 10","-15",angle_img,
						""+dtmp2+" rad",g,fonto,xinit2,y,this);
		    }
		    else if(tempR < 1.0E-15 && tempR >= 1.0E-18){
			//MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E18,2)+" x 10","-18","  \u2220 ",""+dtmp2+" rad",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E18,2)+" x 10","-18",angle_img,
						""+dtmp2+" rad",g,fonto,xinit2,y,this);
		    }
		    else if(tempR < 1.0E-18 && tempR >= 1.0E-21){
			//MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E21,2)+" x 10","-21","  \u2220 ",""+dtmp2+" rad",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E21,2)+" x 10","-21",angle_img,
						""+dtmp2+" rad",g,fonto,xinit2,y,this);
		    }
		    else if(tempR < 1.0E-21 && tempR >= 1.0E-24){
			//MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E24,2)+" x 10","-24","  \u2220 ",""+dtmp2+" rad",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E24,2)+" x 10","-24",angle_img,
						""+dtmp2+" rad",g,fonto,xinit2,y,this);
		    }
                    else if(tempR < 1.0E-24 && tempR >= 1.0E-27){
			//MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E27,2)+" x 10","-27","  \u2220 ",""+dtmp2+" rad",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E27,2)+" x 10","-27",angle_img,
						""+dtmp2+" rad",g,fonto,xinit2,y,this);
		    }
                    else if(tempR < 1.0E-27 && tempR >= 1.0E-30){
			//MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E30,2)+" x 10","-30","  \u2220 ",""+dtmp2+" rad",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E30,2)+" x 10","-30",angle_img,
						""+dtmp2+" rad",g,fonto,xinit2,y,this);
		    }
                    else if(tempR < 1.0E-30 && tempR != 0.0){
			//MaestroG.SansMiditalic("  = 0.0","  \u2220 ",""+dtmp2+" rad",g,fonto,xinit2,y);
			MaestroG.TxtImgTxt("  = 0.0",angle_img,""+dtmp2+" rad",g,fonto,xinit2,y,this);
		    }
		    
                    y += dy;
           	    
		    tempR = Complex.Magnitude(state.wave_impedance);
                    
                    if(tempR == 0.0){dtmp2 = 0.0;}
                    else{dtmp2=MaestroA.rounder(state.wave_impedance.Arg2()*180/Math.PI,4);}
		    if(tempR < 1.0E3 && tempR >= 1.0E-3){
                        //MaestroG.SansMiditalic("  = "+MaestroA.rounder(tempR,6),"  \u2220 ",""+dtmp2+" \u00ba",g,fonto,xinit2,y);
			MaestroG.TxtImgTxt("  = "+MaestroA.rounder(tempR,6),angle_img,""+dtmp2+" \u00ba",g,fonto,xinit2,y,this);
		    }
		    else if(tempR == 0.0){
			//MaestroG.SansMiditalic("  = 0.0","  \u2220 ",""+dtmp2+" \u00ba",g,fonto,xinit2,y);
			MaestroG.TxtImgTxt("  = 0.0",angle_img,""+dtmp2+" \u00ba",g,fonto,xinit2,y,this);
		    }
		    else if(tempR < 1.0E6 && tempR >= 1.0E3){
                        //MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E-3,2)+" x 10","3","  \u2220 ",""+dtmp2+" \u00ba",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E-3,2)+" x 10","3",angle_img,
						""+dtmp2+" \u00ba",g,fonto,xinit2,y,this);
		    }
		    else if(tempR < 1.0E9 && tempR >= 1.0E6){
			//MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E-6,2)+" x 10","6","  \u2220 ",""+dtmp2+" \u00ba",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E-6,2)+" x 10","6",angle_img,
						""+dtmp2+" \u00ba",g,fonto,xinit2,y,this);
		    }
		    else if(tempR < 1.0E12 && tempR >= 1.0E9){
			//MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E-9,2)+" x 10","9","  \u2220 ",""+dtmp2+" \u00ba",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E-9,2)+" x 10","9",angle_img,
						""+dtmp2+" \u00ba",g,fonto,xinit2,y,this);
		    }
		    else if(tempR < 1.0E15 && tempR >= 1.0E12){
			//MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E-12,2)+" x 10","12","  \u2220 ",""+dtmp2+" \u00ba",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E-12,2)+" x 10","12",angle_img,
						""+dtmp2+" \u00ba",g,fonto,xinit2,y,this);
		    }
		    else if(tempR < 1.0E18 && tempR >= 1.0E15){
			//MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E-15,2)+" x 10","15","  \u2220 ",""+dtmp2+" \u00ba",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E-15,2)+" x 10","15",angle_img,
						""+dtmp2+" \u00ba",g,fonto,xinit2,y,this);
		    }
		    else if(tempR < 1.0E21 && tempR >= 1.0E18){
			//MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E-18,2)+" x 10","18","  \u2220 ",""+dtmp2+" \u00ba",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E-18,2)+" x 10","18",angle_img,
						""+dtmp2+" \u00ba",g,fonto,xinit2,y,this);
		    }
		    else if(tempR < 1.0E24 && tempR >= 1.0E21){
			//MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E-21,2)+" x 10","21","  \u2220 ",""+dtmp2+" \u00ba",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E-21,2)+" x 10","21",angle_img,
						""+dtmp2+" \u00ba",g,fonto,xinit2,y,this);
		    }
		    else if(tempR < 1.0E27 && tempR >= 1.0E24){
			//MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E-24,2)+" x 10","24","  \u2220 ",""+dtmp2+" \u00ba",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E-24,2)+" x 10","24",angle_img,
						""+dtmp2+" \u00ba",g,fonto,xinit2,y,this);
		    }
		    else if(tempR < 1.0E30 && tempR >= 1.0E27){
			//MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E-27,2)+" x 10","27","  \u2220 ",""+dtmp2+" \u00ba",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E-27,2)+" x 10","27",angle_img,
						""+dtmp2+" \u00ba",g,fonto,xinit2,y,this);
		    }
		    else if(tempR >= 1.0E30){
			//MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E-30,2)+" x 10","30","  \u2220 ",""+dtmp2+" \u00ba",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E-30,2)+" x 10","30",angle_img,
						""+dtmp2+" \u00ba",g,fonto,xinit2,y,this);
		    }
		    else if(tempR < 1.0E-3 && tempR >= 1.0E-6){
			//MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E6,2)+" x 10","-6","  \u2220 ",""+dtmp2+" \u00ba",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E6,2)+" x 10","-6",angle_img,
						""+dtmp2+" \u00ba",g,fonto,xinit2,y,this);
		    }
		    else if(tempR < 1.0E-6 && tempR >= 1.0E-9){
			//MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E9,2)+" x 10","-9","  \u2220 ",""+dtmp2+" \u00ba",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E9,2)+" x 10","-9",angle_img,
						""+dtmp2+" \u00ba",g,fonto,xinit2,y,this);
		    }
		    else if(tempR < 1.0E-9 && tempR >= 1.0E-12){
			//MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E12,2)+" x 10","-12","  \u2220 ",""+dtmp2+" \u00ba",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E12,2)+" x 10","-12",angle_img,
						""+dtmp2+" \u00ba",g,fonto,xinit2,y,this);
		    }
		    else if(tempR < 1.0E-12 && tempR >= 1.0E-15){
			//MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E15,2)+" x 10","-15","  \u2220 ",""+dtmp2+" \u00ba",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E15,2)+" x 10","-15",angle_img,
						""+dtmp2+" \u00ba",g,fonto,xinit2,y,this);
		    }
		    else if(tempR < 1.0E-15 && tempR >= 1.0E-18){
			//MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E18,2)+" x 10","-18","  \u2220 ",""+dtmp2+" \u00ba",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E18,2)+" x 10","-18",angle_img,
						""+dtmp2+" \u00ba",g,fonto,xinit2,y,this);
		    }
		    else if(tempR < 1.0E-18 && tempR >= 1.0E-21){
			//MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E21,2)+" x 10","-21","  \u2220 ",""+dtmp2+" \u00ba",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E21,2)+" x 10","-21",angle_img,
						""+dtmp2+" \u00ba",g,fonto,xinit2,y,this);
		    }
		    else if(tempR < 1.0E-21 && tempR >= 1.0E-24){
			//MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E24,2)+" x 10","-24","  \u2220 ",""+dtmp2+" \u00ba",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E24,2)+" x 10","-24",angle_img,
						""+dtmp2+" \u00ba",g,fonto,xinit2,y,this);
		    }
                    else if(tempR < 1.0E-24 && tempR >= 1.0E-27){
			//MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E27,2)+" x 10","-27","  \u2220 ",""+dtmp2+" \u00ba",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E27,2)+" x 10","-27",angle_img,
						""+dtmp2+" \u00ba",g,fonto,xinit2,y,this);
		    }
                    else if(tempR < 1.0E-27 && tempR >= 1.0E-30){
			//MaestroG.SansMiditalicSuper("  = "+MaestroA.rounder(tempR*1.0E30,2)+" x 10","-30","  \u2220 ",""+dtmp2+" \u00ba",g,fonto,xinit2,y);
			MaestroG.TxtSuperImgTxt("  = "+MaestroA.rounder(tempR*1.0E30,2)+" x 10","-30",angle_img,
						""+dtmp2+" \u00ba",g,fonto,xinit2,y,this);
		    }
                    else if(tempR < 1.0E-30 && tempR != 0.0){
			//MaestroG.SansMiditalic("  = 0.0","  \u2220 ",""+dtmp2+" \u00ba",g,fonto,xinit2,y);
			MaestroG.TxtImgTxt("  = 0.0",angle_img,""+dtmp2+" \u00ba",g,fonto,xinit2,y,this);
		    }
	
            
            //-----------------------------------------------------------------------------------
            //g.drawLine(5,y,getSize().width-5,y); 
	    g.setColor(Color.red.darker());
	    y += dyy;
	    g.drawString("Penetration (Skin) Depth",x,y);
	    y+= dy;
	    g.setColor(Color.black);
	    temp2 = state.skin_depth;
            
            g.setFont(symbolfont);
            MaestroG.subscripterSymFirst2("\u03b4","s","",g,fonto_delta,x+dxx-state.s3,y);
            g.setFont(normalfont);
                    
	    if(state.skin_depth > 2.0e140){
		//MaestroG.subscripterInfinityTwo("  = ","","","","",g,fonto,xinit2,y);
		g.drawString("  = ",xinit2,y);
		g.drawImage(this.infinity,xinit2+fm.stringWidth("  = "),
			    y-this.infinity.getHeight(),this);
			    
		g.setFont(normalfont);
	    }
	    /*
            else{
		g.setFont(symbolfont);
		g.drawString("\u03b4 z",x+dxx,y);
		g.setFont(normalfont);
		
		g.drawString("  =  "+MaestroA.rounder(state.skin_depth,15)+"   [ m ]",xinit2,y); 
	    }
            */
            //------------------------------------------------------------------       
            else{
                String newtemp;
                if(state.skin_depth/state.wavelength > 1000.0){
                    newtemp =""+(int)(state.skin_depth/state.wavelength);
                }
                else{
                    newtemp =""+MaestroA.rounder(state.skin_depth/state.wavelength,4);
                }
                    //g.setFont(symbolfont);
                    //MaestroG.subscripterSymFirst2("\u03b4","","z",g,fonto,x+dxx,y);
                    //g.setFont(normalfont);
                    
                    if(temp2 >= 1.0E15 && state.frequency > 0.0){
			temp = temp2/1.0E12;
			//MaestroG.superscripter("  =  "+newtemp+"  =  "+temp+"   [ m ]","","",g,fonto,xinit2,y); 
                        MaestroG.superscripterinsert("  =  "+newtemp," \u03bb","  =  "+MaestroA.rounder(temp,5)+"   [ 10","9"," km ]",g,fonto,xinit2,y);
			//g.drawString("  =  "+MaestroA.rounder(temp,8)+"   [ Tm ]",xinit2,y); 
		    }
		    
		    else if(temp2 < 1.0e15 && temp2 >= 1.0E12){
			temp = temp2/1.0E12;
			MaestroG.superscripterinsert("  =  "+newtemp," \u03bb","  =  "+MaestroA.rounder(temp,5)+"   [ 10","9"," km ]",g,fonto,xinit2,y); 
			//g.drawString("  =  "+MaestroA.rounder(temp,8)+"   [ Tm ]",xinit2,y); 
		    }
		    else if(temp2 < 1.0e12 && temp2 >= 1.0e9){
			temp = temp2/1.0E9;
			MaestroG.superscripterinsert("  =  "+newtemp," \u03bb","  =  "+MaestroA.rounder(temp,5)+"   [ 10","6"," km ]",g,fonto,xinit2,y);   
			//g.drawString("  =  "+MaestroA.rounder(temp,8)+"   [ Gm ]",xinit2,y); 
		    }
		    else if(temp2 < 1.0e9 && temp2 >= 1.0e6){
			temp = temp2/1.0E6; 
			MaestroG.superscripterinsert("  =  "+newtemp," \u03bb","  =  "+MaestroA.rounder(temp,5)+"   [ 10","3"," km ]",g,fonto,xinit2,y);  
			//g.drawString("  =  "+MaestroA.rounder(temp,8)+"   [ Mm ]",xinit2,y); 
		    }
		    else if(temp2 < 1.0E6 && temp2 >= 1.0E3){
			temp = temp2/1.0E3;
			MaestroG.superscripterinsert("  =  "+newtemp," \u03bb","  =  "+MaestroA.rounder(temp,5)+"   [ km ]","","",g,fonto,xinit2,y);  
			//g.drawString("  =  "+newtemp+"  =  "+MaestroA.rounder(temp,5)+"   [ km ]",xinit2,y); 
		    }
		    else if(temp2 < 1.0E3 && temp2 >= 1.0){
			MaestroG.superscripterinsert("  =  "+newtemp," \u03bb","  =  "+MaestroA.rounder(temp2,5)+"   [ m ]","","",g,fonto,xinit2,y);  
			//g.drawString("  =  "+newtemp+"  =  "+MaestroA.rounder(temp2,5)+"   [ m ]",xinit2,y); 
		    }
		    else if(temp2 <1.0 && temp2 >= 1.0E-2){
			temp = temp2*1.0E2;
			MaestroG.superscripterinsert("  =  "+newtemp," \u03bb","  =  "+MaestroA.rounder(temp,5)+"   [ cm ]","","",g,fonto,xinit2,y);  
			//g.drawString("  =  "+newtemp+"  =  "+MaestroA.rounder(temp,5)+"   [ cm ]",xinit2,y); 
		    }
		    else if(temp2 <1.0E-2 && temp2 >= 1.0E-4){
			temp = temp2*1.0E3;
			MaestroG.superscripterinsert("  =  "+newtemp," \u03bb","  =  "+MaestroA.rounder(temp,5)+"   [ m ]","","",g,fonto,xinit2,y);  
			//g.drawString("  =  "+newtemp+"  =  "+MaestroA.rounder(temp,5)+"   [ mm ]",xinit2,y); 
		    }
		    else if(temp2 < 1.0E-4 && temp2 >=1.0E-6 ){
			temp = temp2*1.0E6;
			MaestroG.superscripterinsert("  =  "+newtemp," \u03bb","  =  "+MaestroA.rounder(temp,5)+"   [ \u00b5 m ]","","",g,fonto,xinit2,y);  
			//g.drawString("  =  "+newtemp+"  =  "+MaestroA.rounder(temp,5)+"   [ \u00b5 m ]",xinit2,y); 
		    }
		    else if(temp2 < 1.0E-6 && temp2 >=1.0E-9){
			temp = temp2*1.0E9;
			MaestroG.superscripterinsert("  =  "+newtemp," \u03bb","  =  "+MaestroA.rounder(temp,5)+"   [ nm ]","","",g,fonto,xinit2,y);  
			//g.drawString("  =  "+newtemp+"  =  "+MaestroA.rounder(temp,5)+"   [ nm ]",xinit2,y); 
		    }	
		    else if(temp2 < 1.0E-9 && temp2 >=1.0E-12){
			temp = temp2*1.0E12;
			MaestroG.superscripter("  =  "+newtemp+"  =  "+MaestroA.rounder(temp,5)+"   [ 10","-12","  m ]",g,fonto,xinit2,y);  
			//g.drawString("  =  "+MaestroA.rounder(temp,8)+"   [ pm ]",xinit2,y); 
		    }	   
		    else if(temp2 < 1.0E-12 && temp2 >=1.0E-15){
			temp = temp2*1.0E15;
			MaestroG.superscripterinsert("  =  "+newtemp," \u03bb","  =  "+MaestroA.rounder(temp,5)+"   [ 10","-15","  m ]",g,fonto,xinit2,y);  
			//g.drawString("  =  "+MaestroA.rounder(temp,8)+"   [ fm ]",xinit2,y); 
		    }
		    else if(temp2 < 1.0E-15 && temp2 >=1.0e-18){
			temp = temp2*1.0E18;
			MaestroG.superscripterinsert("  =  "+newtemp," \u03bb","  =  "+MaestroA.rounder(temp,5)+"   [ 10","-18","  m ]",g,fonto,xinit2,y);  
			//g.drawString("  =  "+MaestroA.rounder(temp,8)+"   [ am ]",xinit2,y); 
		    }
		    else if(temp2 < 1.0E-18 && temp2 >=1.0E-21){
			temp = temp2*1.0E21;
			MaestroG.superscripterinsert("  =  "+newtemp," \u03bb","  =  "+MaestroA.rounder(temp,5)+"   [ 10","-21","  m ]",g,fonto,xinit2,y);  
			//g.drawString("  =  "+MaestroA.rounder(temp,8)+"   [ fm ]",xinit2,y); 
		    }
		    else if(temp2 < 1.0E-21 && temp2 > 0.0){
			temp = temp2;
			MaestroG.superscripterinsert("  =  "+newtemp," \u03bb","  =  "+temp+" [m]","","",g,fonto,xinit2,y);  
			//g.drawString("  =  "+MaestroA.rounder(temp,8)+"   [ fm ]",xinit2,y); 
		    }
			       
		    else if(temp2 == 0.0){
			MaestroG.superscripterinsert("  =  "+newtemp," \u03bb","  =  "+MaestroA.rounder(temp2,5)+"   [ m ]","","",g,fonto,xinit2,y);  
                        //g.drawString("  =  "+newtemp+"  =  "+MaestroA.rounder(temp2,8)+"   [ m ]",xinit2,y); 
		    }
            }
            
            //------------------------------------------------------------------
	    
	    //g.drawLine(state.s5,y,getSize().width-state.s5,y); 
	    y += dyy;
	    g.setColor(Color.red.darker());
	    g.drawString("Phase and Attenuation Constants",x,y);
	    y += dy;
	    g.setColor(Color.black);
            MaestroG.superscripter(" [ m","-1"," ]",g,fonto,x+dxx+state.s150,y);
	    
	    if(state.beta < 1.0e-15){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta*1.0e16,5)+"  x  10","-16"," ",g,fonto,xinit2,y);
	    }
            if(state.beta >= 1.0e-15 && state.beta < 1.0e-14){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta*1.0e15,5)+"  x  10","-15"," ",g,fonto,xinit2,y);
	    }
            if(state.beta >= 1.0e-14 && state.beta < 1.0e-13){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta*1.0e14,5)+"  x  10","-14"," ",g,fonto,xinit2,y);
	    }
            if(state.beta >= 1.0e-13 && state.beta < 1.0e-12){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta*1.0e13,5)+"  x  10","-13"," ",g,fonto,xinit2,y);
	    }
	    if(state.beta >= 1.0e-12 && state.beta < 1.0e-11){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta*1.0e12,5)+"  x  10","-12"," ",g,fonto,xinit2,y);
	    }
	    if(state.beta >= 1.0e-11 && state.beta < 1.0e-10){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta*1.0e11,5)+"  x  10","-11"," ",g,fonto,xinit2,y);
	    }
	    if(state.beta >= 1.0e-10 && state.beta < 1.0e-9){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta*1.0e10,5)+"  x  10","-10"," ",g,fonto,xinit2,y);
	    }
	    if(state.beta >= 1.0e-9 && state.beta < 1.0e-8){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta*1.0e9,5)+"  x  10","-9"," ",g,fonto,xinit2,y);
	    }
	    
	    if(state.beta >= 1.0e-8 && state.beta < 1.0e-7){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta*1.0e8,5)+"  x  10","-8"," ",g,fonto,xinit2,y);
	    }
	    if(state.beta >= 1.0e-7 && state.beta < 1.0e-6){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta*1.0e7,5)+"  x  10","-7"," ",g,fonto,xinit2,y);
	    }
	    if(state.beta >= 1.0e-6 && state.beta < 1.0e-5){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta*1.0e6,5)+"  x  10","-6"," ",g,fonto,xinit2,y);
	    }
	    if(state.beta >= 1.0e-5 && state.beta < 1.0e-4){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta*1.0e5,5)+"  x  10","-5"," ",g,fonto,xinit2,y);
	    }
	    if(state.beta >= 1.0e-4 && state.beta < 1.0e-3){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta*1.0e4,5)+"  x  10","-4"," ",g,fonto,xinit2,y);
	    }
	    if(state.beta >= 1.0e-3 && state.beta < 1.0e-2){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta*1.0e3,5)+"  x  10","-3"," ",g,fonto,xinit2,y);
	    }
	    if(state.beta >= 1.0e-2 && state.beta < 1.0e-1){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta*1.0e2,5)+"  x  10","-2"," ",g,fonto,xinit2,y);
	    }
	    if(state.beta >= 1.0e-1 && state.beta < 1.0){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta*1.0e1,5)+"  x  10","-1"," ",g,fonto,xinit2,y);
	    }
	    if(state.beta >= 1.0 && state.beta < 1.0e1){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta,5)+"  ",""," ",g,fonto,xinit2,y);
	    }
	    if(state.beta >= 1.0e1 && state.beta < 1.0e2){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta,5)+"  ",""," ",g,fonto,xinit2,y);
	    }
	    if(state.beta >= 1.0e2 && state.beta < 1.0e3){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta*1.0e-2,5)+"  x  10","2"," ",g,fonto,xinit2,y);
	    }
	    if(state.beta >= 1.0e3 && state.beta < 1.0e4){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta*1.0e-3,5)+"  x  10","3"," ",g,fonto,xinit2,y);
	    }
	    if(state.beta >= 1.0e4 && state.beta < 1.0e5){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta*1.0e-4,5)+"  x  10","4"," ",g,fonto,xinit2,y);
	    }
	    if(state.beta >= 1.0e5 && state.beta < 1.0e6){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta*1.0e-5,5)+"  x  10","5"," ",g,fonto,xinit2,y);
	    }
	    if(state.beta >= 1.0e6 && state.beta < 1.0e7){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta*1.0e-6,5)+"  x  10","6"," ",g,fonto,xinit2,y);
	    }
	    if(state.beta >= 1.0e7 && state.beta < 1.0e8){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta*1.0e-7,5)+"  x  10","7"," ",g,fonto,xinit2,y);
	    }
	    if(state.beta >= 1.0e8 && state.beta < 1.0e9){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta*1.0e-8,5)+"  x  10","8"," ",g,fonto,xinit2,y);
	    }
	    if(state.beta >= 1.0e9 && state.beta < 1.0e10){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta*1.0e-9,5)+"  x  10","9"," ",g,fonto,xinit2,y);
	    }
	    if(state.beta >= 1.0e10 && state.beta < 1.0e11){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta*1.0e-10,5)+"  x  10","10"," ",g,fonto,xinit2,y);
	    }
	    if(state.beta >= 1.0e11 && state.beta < 1.0e12){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta*1.0e-11,5)+"  x  10","11"," ",g,fonto,xinit2,y);
	    }
	    if(state.beta >= 1.0e12 && state.beta < 1.0e13){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta*1.0e-12,5)+"  x  10","12"," ",g,fonto,xinit2,y);
	    }
	    if(state.beta >= 1.0e13 && state.beta < 1.0e14){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta*1.0e-13,5)+"  x  10","13"," ",g,fonto,xinit2,y);
	    }
	    if(state.beta >= 1.0e14 && state.beta < 1.0e15){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta*1.0e-14,5)+"  x  10","14"," ",g,fonto,xinit2,y);
	    }
	    if(state.beta >= 1.0e15 && state.beta < 1.0e16){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta*1.0e-15,5)+"  x  10","15"," ",g,fonto,xinit2,y);
	    }
	    if(state.beta >= 1.0e16 && state.beta < 1.0e17){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta*1.0e-16,5)+"  x  10","16"," ",g,fonto,xinit2,y);
	    }
	    if(state.beta >= 1.0e17 && state.beta < 1.0e18){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta*1.0e-17,5)+"  x  10","17"," ",g,fonto,xinit2,y);
	    }
	    if(state.beta >= 1.0e18 && state.beta < 1.0e19){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta*1.0e-18,5)+"  x  10","18"," ",g,fonto,xinit2,y);
	    }
	    if(state.beta >= 1.0e19 && state.beta < 1.0e20){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta*1.0e-19,5)+"  x  10","19"," ",g,fonto,xinit2,y);
	    }
	    if(state.beta >= 1.0e20 && state.beta < 1.0e21){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.beta*1.0e-20,5)+"  x  10","20"," ",g,fonto,xinit2,y);
	    }
	    if(state.beta >= 1.0e21){
		MaestroG.superscripter("  =  "+state.beta+"",""," ",g,fonto,xinit2,y);
	    }
	    
	    g.setFont(symbolfont);
	    g.drawString("\u03b2",x+dxx,y);
	    g.setFont(normalfont);
	    
	    y += dy;
	    g.setColor(Color.black);
	    g.drawString(" [ Ne / m ]",x+dxx+state.s150,y);
	    //g.drawString("     =  "+MaestroA.rounder(state.alpha,15),x+dxx,y);
	    if(state.alpha == 0.0){
                g.drawString("  =  "+MaestroA.rounder(state.alpha,15),xinit2,y);
            }
            if(state.alpha < 1.0e-20 && state.alpha > 0.0){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e21,5)+"  x  10","-21"," ",g,fonto,xinit2,y);
	    }
            if(state.alpha >= 1.0e-20 && state.alpha < 1.0e-19){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e20,5)+"  x  10","-20"," ",g,fonto,xinit2,y);
	    }
            if(state.alpha >= 1.0e-19 && state.alpha < 1.0e-18){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e19,5)+"  x  10","-19"," ",g,fonto,xinit2,y);
	    }
            if(state.alpha >= 1.0e-18 && state.alpha < 1.0e-17){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e18,5)+"  x  10","-18"," ",g,fonto,xinit2,y);
	    }
            if(state.alpha >= 1.0e-17 && state.alpha < 1.0e-16){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e17,5)+"  x  10","-17"," ",g,fonto,xinit2,y);
	    }
            if(state.alpha >= 1.0e-16 && state.alpha < 1.0e-15){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e16,5)+"  x  10","-16"," ",g,fonto,xinit2,y);
	    }
            if(state.alpha >= 1.0e-15 && state.alpha < 1.0e-14){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e15,5)+"  x  10","-15"," ",g,fonto,xinit2,y);
	    }
            if(state.alpha >= 1.0e-14 && state.alpha < 1.0e-13){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e14,5)+"  x  10","-14"," ",g,fonto,xinit2,y);
	    }
            if(state.alpha >= 1.0e-13 && state.alpha < 1.0e-12){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e13,5)+"  x  10","-13"," ",g,fonto,xinit2,y);
	    }
	    if(state.alpha >= 1.0e-12 && state.alpha < 1.0e-11){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e12,5)+"  x  10","-12"," ",g,fonto,xinit2,y);
	    }
	    if(state.alpha >= 1.0e-11 && state.alpha < 1.0e-10){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e11,5)+"  x  10","-11"," ",g,fonto,xinit2,y);
	    }
	    if(state.alpha >= 1.0e-10 && state.alpha < 1.0e-9){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e10,5)+"  x  10","-10"," ",g,fonto,xinit2,y);
	    }
	    if(state.alpha >= 1.0e-9 && state.alpha < 1.0e-8){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e9,5)+"  x  10","-9"," ",g,fonto,xinit2,y);
	    }
	    
	    if(state.alpha >= 1.0e-8 && state.alpha < 1.0e-7){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e8,5)+"  x  10","-8"," ",g,fonto,xinit2,y);
	    }
	    if(state.alpha >= 1.0e-7 && state.alpha < 1.0e-6){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e7,5)+"  x  10","-7"," ",g,fonto,xinit2,y);
	    }
	    if(state.alpha >= 1.0e-6 && state.alpha < 1.0e-5){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e6,5)+"  x  10","-6"," ",g,fonto,xinit2,y);
	    }
	    if(state.alpha >= 1.0e-5 && state.alpha < 1.0e-4){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e5,5)+"  x  10","-5"," ",g,fonto,xinit2,y);
	    }
	    if(state.alpha >= 1.0e-4 && state.alpha < 1.0e-3){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e4,5)+"  x  10","-4"," ",g,fonto,xinit2,y);
	    }
	    if(state.alpha >= 1.0e-3 && state.alpha < 1.0e-2){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e3,5)+"  x  10","-3"," ",g,fonto,xinit2,y);
	    }
	    if(state.alpha >= 1.0e-2 && state.alpha < 1.0e-1){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e2,5)+"  x  10","-2"," ",g,fonto,xinit2,y);
	    }
	    if(state.alpha >= 1.0e-1 && state.alpha < 1.0){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e1,5)+"  x  10","-1"," ",g,fonto,xinit2,y);
	    }
	    if(state.alpha >= 1.0 && state.alpha < 1.0e1){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha,5)+"  ",""," ",g,fonto,xinit2,y);
	    }
	    if(state.alpha >= 1.0e1 && state.alpha < 1.0e2){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha,5)+"  ",""," ",g,fonto,xinit2,y);
	    }
	    if(state.alpha >= 1.0e2 && state.alpha < 1.0e3){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e-2,5)+"  x  10","2"," ",g,fonto,xinit2,y);
	    }
	    if(state.alpha >= 1.0e3 && state.alpha < 1.0e4){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e-3,5)+"  x  10","3"," ",g,fonto,xinit2,y);
	    }
	    if(state.alpha >= 1.0e4 && state.alpha < 1.0e5){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e-4,5)+"  x  10","4"," ",g,fonto,xinit2,y);
	    }
	    if(state.alpha >= 1.0e5 && state.alpha < 1.0e6){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e-5,5)+"  x  10","5"," ",g,fonto,xinit2,y);
	    }
	    if(state.alpha >= 1.0e6 && state.alpha < 1.0e7){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e-6,5)+"  x  10","6"," ",g,fonto,xinit2,y);
	    }
	    if(state.alpha >= 1.0e7 && state.alpha < 1.0e8){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e-7,5)+"  x  10","7"," ",g,fonto,xinit2,y);
	    }
	    if(state.alpha >= 1.0e8 && state.alpha < 1.0e9){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e-8,5)+"  x  10","8"," ",g,fonto,xinit2,y);
	    }
	    if(state.alpha >= 1.0e9 && state.alpha < 1.0e10){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e-9,5)+"  x  10","9"," ",g,fonto,xinit2,y);
	    }
	    if(state.alpha >= 1.0e10 && state.alpha < 1.0e11){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e-10,5)+"  x  10","10"," ",g,fonto,xinit2,y);
	    }
	    if(state.alpha >= 1.0e11 && state.alpha < 1.0e12){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e-11,5)+"  x  10","11"," ",g,fonto,xinit2,y);
	    }
	    if(state.alpha >= 1.0e12 && state.alpha < 1.0e13){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e-12,5)+"  x  10","12"," ",g,fonto,xinit2,y);
	    }
	    if(state.alpha >= 1.0e13 && state.alpha < 1.0e14){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e-13,5)+"  x  10","13"," ",g,fonto,xinit2,y);
	    }
	    if(state.alpha >= 1.0e14 && state.alpha < 1.0e15){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e-14,5)+"  x  10","14"," ",g,fonto,xinit2,y);
	    }
	    if(state.alpha >= 1.0e15 && state.alpha < 1.0e16){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e-15,5)+"  x  10","15"," ",g,fonto,xinit2,y);
	    }
	    if(state.alpha >= 1.0e16 && state.alpha < 1.0e17){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e-16,5)+"  x  10","16"," ",g,fonto,xinit2,y);
	    }
	    if(state.alpha >= 1.0e17 && state.alpha < 1.0e18){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e-17,5)+"  x  10","17"," ",g,fonto,xinit2,y);
	    }
	    if(state.alpha >= 1.0e18 && state.alpha < 1.0e19){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e-18,5)+"  x  10","18"," ",g,fonto,xinit2,y);
	    }
	    if(state.alpha >= 1.0e19 && state.alpha < 1.0e20){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e-19,5)+"  x  10","19"," ",g,fonto,xinit2,y);
	    }
	    if(state.alpha >= 1.0e20 && state.alpha < 1.0e21){
		MaestroG.superscripter("  =  "+MaestroA.rounder(state.alpha*1.0e-20,5)+"  x  10","20"," ",g,fonto,xinit2,y);
	    }
	    if(state.alpha >= 1.0e21){
		MaestroG.superscripter("  =  "+state.alpha+"",""," ",g,fonto,xinit2,y);
	    }
	    
	    g.setFont(symbolfont);
	    g.drawString("\u03b1",x+dxx,y);
	    g.setFont(normalfont);
	    
	    
            g.setColor(Color.black);
            //g.drawRect(10,y+7,getSize().width-25,38);
            g.drawLine(state.s5,y+state.s10,getSize().width-state.s5,y+state.s10); 
            
            y += dyy + state.s10;
	    g.setColor(Color.red.darker());
	    
	    g.setFont(symbolfont);
	    g.drawString("\u03c3 / \u03c9\u03b5",x - state.s5,y);
	    g.setFont(normalfont);
	    
	    
	    g.setColor(Color.black);
	    temp = state.conductivity/2.0/Math.PI/state.frequency/state.epsilon0/state.epsilon_r;
	    
	    if(state.conductivity == 0.0){
		if( state.epsilon_r > 1.0){
		    g.drawString("  =  "+MaestroA.rounder(temp,8)+"",xinit2,y);
		    y+=dyy;
		    g.setColor(Color.magenta.darker());
		    g.drawString("The material is a perfect dielectric",x-state.s5,y);
		}
		else{
		    g.drawString("  =  "+MaestroA.rounder(temp,8)+"",xinit2,y);
		    y+=dyy;
		    g.setColor(Color.magenta.darker());
		    g.drawString("The material is vacuum (perfect dielectric)",x-state.s5,y);
		}
	    }
	    
	    if(state.conductivity != 0.0){
		if(temp >= 100.0){
		    //g.drawString("  =  "+MaestroA.rounder(temp,8)+"   >> 1",xinit2,y);
                    //----------------------------------------------------------
                    if(temp <= 1.0E2 && temp > 1.0e1){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp,5)+"","","   >>  1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0E3 && temp > 1.0e2){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0E-2,5)+"  x  10","2","   >>  1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0E4 && temp > 1.0e3){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0E-3,5)+"  x  10","3","   >>  1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0E5 && temp > 1.0e4){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0E-4,5)+"  x  10","4","   >>  1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0E6 && temp > 1.0e5){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0E-5,5)+"  x  10","5","   >>  1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0E7 && temp > 1.0e6){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0E-6,5)+"  x  10","6","   >>  1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0E8 && temp > 1.0e7){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0E-7,5)+"  x  10","7","   >>  1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0E9 && temp > 1.0e8){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0E-8,5)+"  x  10","8","   >>  1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0E10 && temp > 1.0e9){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0E-9,5)+"  x  10","9","   >>  1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0E11 && temp > 1.0e10){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0E-10,5)+"  x  10","10","   >>  1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0E12 && temp > 1.0e11){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0E-11,5)+"  x  10","11","   >>  1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0E13 && temp > 1.0e12){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0E-12,5)+"  x  10","12","   >>  1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0E14 && temp > 1.0e13){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0E-13,5)+"  x  10","13","   >>  1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0E15 && temp > 1.0e14){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0E-14,5)+"  x  10","14","   >>  1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0E16 && temp > 1.0e15){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0E-15,5)+"  x  10","15","   >>  1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0E17 && temp > 1.0e16){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0E-16,5)+"  x  10","16","   >> 1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0E18 && temp > 1.0e17){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0E-17,5)+"  x  10","17","   >> 1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0E19 && temp > 1.0e18){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0E-18,5)+"  x  10","18","   >> 1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0E20 && temp > 1.0e19){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0E-19,5)+"  x  10","19","   >> 1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0E21 && temp > 1.0e20){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0E-20,5)+"  x  10","20","   >> 1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0E22 && temp > 1.0e21){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0E-21,5)+"  x  10","21","   >> 1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0E23 && temp > 1.0e22){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0E-22,5)+"  x  10","22","   >> 1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0E24 && temp > 1.0e23){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0E-23,5)+"  x  10","23","   >>  1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0E27 && temp > 1.0e24){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0E-24,5)+"  x  10","24","   >>  1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0E30 && temp > 1.0e27){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0E-27,5)+"  x  10","27","   >>  1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0E33 && temp > 1.0e30){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0E-30,5)+"  x  10","30","   >>  1",g,fonto,xinit2,y);
                    }
                    else if(temp > 1.0e33){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0E-33,5)+"  x  10","33","   >>  1",g,fonto,xinit2,y);
                    }
                    //----------------------------------------------------------
                    
		    y+=dyy;
		    g.setColor(Color.magenta.darker());
		    g.drawString("The material is a good conductor",x-state.s5,y);
		}
		if(temp <= 0.01 ){
                    if(temp <= 0.1 && temp > 1.0e-2){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0e2,5)+"  x  10","-2","   <<  1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0e-2 && temp > 1.0e-3){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0e3,5)+"  x  10","-3","   <<  1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0e-3 && temp > 1.0e-4){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0e4,5)+"  x  10","-4","   <<  1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0e-4 && temp > 1.0e-5){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0e5,5)+"  x  10","-5","   <<  1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0e-5 && temp > 1.0e-6){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0e6,5)+"  x  10","-6","   <<  1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0e-6 && temp > 1.0e-7){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0e7,5)+"  x  10","-7","   <<  1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0e-7 && temp > 1.0e-8){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0e8,5)+"  x  10","-8","   <<  1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0e-8 && temp > 1.0e-9){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0e9,5)+"  x  10","-9","   <<  1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0e-9 && temp > 1.0e-10){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0e10,5)+"  x  10","-10","   <<  1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0e-10 && temp > 1.0e-11){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0e11,5)+"  x  10","-11","   <<  1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0e-11 && temp > 1.0e-12){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0e12,5)+"  x  10","-12","   <<  1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0e-12 && temp > 1.0e-13){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0e13,5)+"  x  10","-13","   <<  1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0e-13 && temp > 1.0e-14){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0e14,5)+"  x  10","-14","   <<  1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0e-14 && temp > 1.0e-15){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0e15,5)+"  x  10","-15","   <<  1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0e-15 && temp > 1.0e-16){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0e16,5)+"  x  10","-16","   <<  1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0e-16 && temp > 1.0e-17){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0e17,5)+"  x  10","-17","   <<  1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0e-17 && temp > 1.0e-18){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0e18,5)+"  x  10","-18","   <<  1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0e-18 && temp > 1.0e-19){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0e19,5)+"  x  10","-19","   <<  1",g,fonto,xinit2,y);
                    }
                    else if(temp <= 1.0e-19){
                        MaestroG.superscripter("  =  "+MaestroA.rounder(temp*1.0e20,5)+"  x  10","-20","   <<  1",g,fonto,xinit2,y);
                    }
                    y+=dyy;
		    g.setColor(Color.magenta.darker());
		    g.drawString("The material is an imperfect dielectric",x-state.s5,y);
		}
	    
		if(temp > 0.01 && temp  < 100.0){
		    g.drawString("  =  "+MaestroA.rounder(temp,5)+"",xinit2,y);
		    y+=dyy;
		    g.setColor(Color.magenta.darker());
		    g.drawString("0.01 < (\u03c3 / \u03c9\u03b5) < 100.0   General medium",x-state.s5,y);
		}
	     }
	} 
}

class PlaneWaveOutputCanvasB extends Canvas{
	private static final Font normalfont = new Font("SanSerif",Font.PLAIN,11);
	private static final Font subfont    = new Font("SanSerif",Font.PLAIN,10);
	PlaneWave_State state;
	
        private Image im;
	private Graphics buf;

        public PlaneWaveOutputCanvasB(PlaneWave_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, dy, dyy, xinit2, xshift1, xshift2, xshift3, fonto;
	    double v_normalized, SA, SB, PA, PB, Pdiff;
	    String unita;
            Graphics2D g2d = (Graphics2D)g;
            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
            
            g.clearRect(0,0,getSize().width,getSize().height);
	    
            int startx = state.s12;
            
            //g.setColor(Color.gray);
            //MaestroG.subscripterBold("Output","","",g,state.font14,startx+1,startx+state.s6);
            g.setColor(Color.red.darker());
            MaestroG.subscripterBold("Output","","",g,state.font14,startx,startx+state.s5);
            
            
            FontMetrics fm;
	    x = state.s10;
	    y = state.s50;
	    dx = state.s80;
	    dxx = state.s15;
            
            xshift1 = state.s40;
            xshift2 = state.s30;
            xshift3 = state.s5;
            
            fonto = state.font11;
            
	    g.setFont(normalfont);
	    fm = g.getFontMetrics();
	    dy = fm.getHeight() + state.s8;
	    dyy = dy + state.s10;
            
            xinit2 = x+dxx + state.s90;
            
	    SA = state.Ex*state.Ex/(2.0*Complex.Magnitude(state.wave_impedance))
		    *Math.cos(Complex.Arg1(state.wave_impedance))*Math.exp(-2.0*state.alpha*state.zpos[0]*state.wavelength);
	    SB = state.Ex*state.Ex/(2.0*Complex.Magnitude(state.wave_impedance))
		    *Math.cos(Complex.Arg1(state.wave_impedance))*Math.exp(-2.0*state.alpha*state.zpos[1]*state.wavelength);
	    PA = SA* state.window_area;
	    PB = SB* state.window_area;
	    
	    if(state.zpos[0] < state.zpos[1]){Pdiff = PA - PB;}
	    else{Pdiff = PB - PA;}
	    
	    g.setColor(Color.red.darker());
            
            //------------------------------------------------------------------ Item 1
	    MaestroG.subscripter("Average Power Density at section A","","",g,state.font11,x,y);
	    y += dy;
	    g.setColor(Color.black);
	    
            unita="[W/m\u00b2]";
            MaestroG.subscripter("S","av","(A)",g,state.font11,x+dxx+xshift1,y);
            printdata(SA,g,fonto,xinit2,y,unita);
	    
            y += dy;
	    
            //------------------------------------------------------------------ Item 2
            g.setColor(Color.red.darker());
	    MaestroG.subscripter("Time-Average Power flowing through window A","","",g,state.font11,x,y);
	    y+= dy;
	    g.setColor(Color.black);
	    
            unita="[W]";
            //MaestroG.subscripter("< p","tot","(A) >",g,12,x+dxx+xshift2,y);
            MaestroG.subscripterSansBackItalic("P(A) = S","av","(A) \u00b7 Area","",g,state.font11,x,y);
            
            printdata(PA,g,fonto,xinit2,y,unita);
	    
            y += state.s10;
            g.drawLine(state.s5,y,getSize().width-state.s5,y); 
	    
            y += dy;
	    
            //------------------------------------------------------------------ Item 3
            g.setColor(Color.red.darker());
	    MaestroG.subscripter("Average Power Density at section B","","",g,state.font11,x,y);
	    
	    y+= dy;
	    g.setColor(Color.black);
	    unita="[W/m\u00b2]";
            MaestroG.subscripter("S","av","(B)",g,state.font11,x+dxx+xshift1,y);
            printdata(SB,g,fonto,xinit2,y,unita);
	    
            y += dy;
            
            //------------------------------------------------------------------ Item 4
	    g.setColor(Color.red.darker());
	    MaestroG.subscripter("Time-Average Power flowing through window B","","",g,state.font11,x,y);
	    y+= dy;
	    g.setColor(Color.black);
	    unita="[W]";
            MaestroG.subscripterSansBackItalic("P(B) = S","av","(B) \u00b7 Area","",g,state.font11,x,y);
            
            printdata(PB,g,fonto,xinit2,y,unita);
	    
            y += state.s10;
            g.drawLine(state.s5,y,getSize().width-state.s5,y);
	    y += dy;
	    
            //------------------------------------------------------------------ Item 5
	    g.setColor(Color.red.darker());
            MaestroG.subscripter("Time-Average Power dissipated between A & B","","",g,state.font11,x,y);
	    
	    y += dy;
	    g.setColor(Color.black);
    	    if(state.zpos[0] < state.zpos[1]){
                MaestroG.subsub("P(A)",""," - P(B)","","",g,state.font11,x+xshift3*4,y);
            }
	    else{
                //MaestroG.subsub("< p","tot","(B) - p","tot","(A) >",g,12,x+xshift3,y);
                MaestroG.subsub("P(B)",""," - P(A)","","",g,state.font11,x+xshift3*4,y);
	    }
	    
            unita="[W]";
            printdata(Pdiff,g,fonto,xinit2,y,unita);
	    
            //g.drawLine(5,y+dyy/4,getSize().width-5,y+dyy/4); 
	     
	}
        
        public static void printdata(double power, Graphics g, int fonto, int xinit2, int y, String unita){
            if(power < 1.0e-15 && power != 0.0){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power*1.0e16,5)+"  x  10","-16"," "+unita,g,fonto,xinit2,y);
	    }
            if(power == 0.0){
		MaestroG.superscripter("  =  0.0",""," "+unita,g,fonto,xinit2,y);
	    }
            if(power >= 1.0e-15 && power < 1.0e-14){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power*1.0e15,5)+"  x  10","-15"," "+unita,g,fonto,xinit2,y);
	    }
            if(power >= 1.0e-14 && power < 1.0e-13){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power*1.0e14,5)+"  x  10","-14"," "+unita,g,fonto,xinit2,y);
	    }
            if(power >= 1.0e-13 && power < 1.0e-12){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power*1.0e13,5)+"  x  10","-13"," "+unita,g,fonto,xinit2,y);
	    }
	    if(power >= 1.0e-12 && power < 1.0e-11){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power*1.0e12,5)+"  x  10","-12"," "+unita,g,fonto,xinit2,y);
	    }
	    if(power >= 1.0e-11 && power < 1.0e-10){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power*1.0e11,5)+"  x  10","-11"," "+unita,g,fonto,xinit2,y);
	    }
	    if(power >= 1.0e-10 && power < 1.0e-9){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power*1.0e10,5)+"  x  10","-10"," "+unita,g,fonto,xinit2,y);
	    }
	    if(power >= 1.0e-9 && power < 1.0e-8){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power*1.0e9,5)+"  x  10","-9"," "+unita,g,fonto,xinit2,y);
	    }
	    
	    if(power >= 1.0e-8 && power < 1.0e-7){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power*1.0e8,5)+"  x  10","-8"," "+unita,g,fonto,xinit2,y);
	    }
	    if(power >= 1.0e-7 && power < 1.0e-6){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power*1.0e7,5)+"  x  10","-7"," "+unita,g,fonto,xinit2,y);
	    }
	    if(power >= 1.0e-6 && power < 1.0e-5){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power*1.0e6,5)+"  x  10","-6"," "+unita,g,fonto,xinit2,y);
	    }
	    if(power >= 1.0e-5 && power < 1.0e-4){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power*1.0e5,5)+"  x  10","-5"," "+unita,g,fonto,xinit2,y);
	    }
	    if(power >= 1.0e-4 && power < 1.0e-3){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power*1.0e4,5)+"  x  10","-4"," "+unita,g,fonto,xinit2,y);
	    }
	    if(power >= 1.0e-3 && power < 1.0e-2){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power*1.0e3,5)+"  x  10","-3"," "+unita,g,fonto,xinit2,y);
	    }
	    if(power >= 1.0e-2 && power < 1.0e-1){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power*1.0e2,5)+"  x  10","-2"," "+unita,g,fonto,xinit2,y);
	    }
	    if(power >= 1.0e-1 && power < 1.0){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power*1.0e1,5)+"  x  10","-1"," "+unita,g,fonto,xinit2,y);
	    }
	    if(power >= 1.0 && power < 1.0e1){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power,5)+"  ",""," "+unita,g,fonto,xinit2,y);
	    }
	    if(power >= 1.0e1 && power < 1.0e2){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power,5)+"  ",""," "+unita,g,fonto,xinit2,y);
	    }
	    if(power >= 1.0e2 && power < 1.0e3){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power*1.0e-2,5)+"  x  10","2"," "+unita,g,fonto,xinit2,y);
	    }
	    if(power >= 1.0e3 && power < 1.0e4){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power*1.0e-3,5)+"  x  10","3"," "+unita,g,fonto,xinit2,y);
	    }
	    if(power >= 1.0e4 && power < 1.0e5){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power*1.0e-4,5)+"  x  10","4"," "+unita,g,fonto,xinit2,y);
	    }
	    if(power >= 1.0e5 && power < 1.0e6){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power*1.0e-5,5)+"  x  10","5"," "+unita,g,fonto,xinit2,y);
	    }
	    if(power >= 1.0e6 && power < 1.0e7){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power*1.0e-6,5)+"  x  10","6"," "+unita,g,fonto,xinit2,y);
	    }
	    if(power >= 1.0e7 && power < 1.0e8){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power*1.0e-7,5)+"  x  10","7"," "+unita,g,fonto,xinit2,y);
	    }
	    if(power >= 1.0e8 && power < 1.0e9){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power*1.0e-8,5)+"  x  10","8"," "+unita,g,fonto,xinit2,y);
	    }
	    if(power >= 1.0e9 && power < 1.0e10){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power*1.0e-9,5)+"  x  10","9"," "+unita,g,fonto,xinit2,y);
	    }
	    if(power >= 1.0e10 && power < 1.0e11){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power*1.0e-10,5)+"  x  10","10"," "+unita,g,fonto,xinit2,y);
	    }
	    if(power >= 1.0e11 && power < 1.0e12){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power*1.0e-11,5)+"  x  10","11"," "+unita,g,fonto,xinit2,y);
	    }
	    if(power >= 1.0e12 && power < 1.0e13){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power*1.0e-12,5)+"  x  10","12"," "+unita,g,fonto,xinit2,y);
	    }
	    if(power >= 1.0e13 && power < 1.0e14){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power*1.0e-13,5)+"  x  10","13"," "+unita,g,fonto,xinit2,y);
	    }
	    if(power >= 1.0e14 && power < 1.0e15){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power*1.0e-14,5)+"  x  10","14"," "+unita,g,fonto,xinit2,y);
	    }
	    if(power >= 1.0e15 && power < 1.0e16){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power*1.0e-15,5)+"  x  10","15"," "+unita,g,fonto,xinit2,y);
	    }
	    if(power >= 1.0e16 && power < 1.0e17){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power*1.0e-16,5)+"  x  10","16"," "+unita,g,fonto,xinit2,y);
	    }
	    if(power >= 1.0e17 && power < 1.0e18){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power*1.0e-17,5)+"  x  10","17"," "+unita,g,fonto,xinit2,y);
	    }
	    if(power >= 1.0e18 && power < 1.0e19){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power*1.0e-18,5)+"  x  10","18"," "+unita,g,fonto,xinit2,y);
	    }
	    if(power >= 1.0e19 && power < 1.0e20){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power*1.0e-19,5)+"  x  10","19"," "+unita,g,fonto,xinit2,y);
	    }
	    if(power >= 1.0e20 && power < 1.0e21){
		MaestroG.superscripter("  =  "+MaestroA.rounder(power*1.0e-20,5)+"  x  10","20"," "+unita,g,fonto,xinit2,y);
	    }
	    if(power >= 1.0e21){
		MaestroG.superscripter("  =  "+power+"",""," "+unita,g,fonto,xinit2,y);
	    }
        }
}
