//Trans_OutputPanel.java

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

public class Trans_OutputPanel extends Panel implements ItemListener{
    private static final Color bgcolor = new Color(230,230,230);
    //private static final Color bgcolor = Color.lightGray;
    
    private static final Font labfont=TheFonts.sanSerif12;
    private static final Font titlefont=TheFonts.bold16;
    private static final Font normalfont = TheFonts.sanSerif12;
    private static final Font symbolfont = TheFonts.serif12;
    private static final Font subfont    = TheFonts.sanSerif10;
    Label titlelabel;
    public Choice c1;
    public SpaceDependentCanvas canvas1;
    Trans_State state;
    
    public Trans_OutputPanel(Trans_State state){
	super();
	this.state = state;
	titlelabel = new Label("Data",Label.LEFT);
	setLayout(null);
	add(titlelabel);
	titlelabel.setFont(titlefont);
    
	setBackground(bgcolor);
	
	c1 = new Choice();
	c1.addItem("     Transmission Line Data 1");
	c1.addItem("     Transmission Line Data 2");
	c1.addItem("     Shunt Reactances Data");
	
	c1.setBackground(bgcolor.brighter());
	
	canvas1 = new SpaceDependentCanvas(state);
	
	add(titlelabel);
	//add(c1);
	add(canvas1);
	
	titlelabel.setBounds(10,2,45,25);
	c1.setBounds(80,2,220,25);
	canvas1.setBounds(6,6,298,280);
        
	//Listeners
	c1.addItemListener(this);
    }
    
    public void itemStateChanged(ItemEvent evt){
	ItemSelectable ie = evt.getItemSelectable();
	    if(evt.getSource()==c1){
		if(ie.getSelectedObjects()[0]=="     Transmission Line Data 1"){
		    canvas1.setVisible(true);
		    
		}
		else if(ie.getSelectedObjects()[0]=="     Transmission Line Data 2"){
		    canvas1.setVisible(false);
		    
		}
		else if(ie.getSelectedObjects()[0]=="     Shunt Reactances Data"){
		    canvas1.setVisible(false);
		    
		}
	    }
    }	
    
    /*public void paint(Graphics g){
	    g.setColor(Color.lightGray);
	    g.fill3DRect(0,0,getSize().width-1,getSize().height-1,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 = TheFonts.sanSerif12;
	private static final Font symbolfont = TheFonts.serif12;
	private static final Font subfont    = TheFonts.sanSerif10;
	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){
            
            Graphics2D g2d = (Graphics2D)g;
            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
		
	    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 light_velocity = 3.0E8; //  Units m/s  - approximate value for 
	    double testlength, testlength2, testprint, testperiod;
	    int x, y, dx, dxx, dy, dyy;
	    Complex tempc;
	    FontMetrics fm;
	    x = 10;
	    y = 35;
	    dx = 105;
	    dxx = 15;
	    g.setFont(normalfont);
	    fm = g.getFontMetrics();
	    dy = fm.getHeight();
	    dyy = dy+6;
	    g.clearRect(0,0,getSize().width,getSize().height);
	    
	    g.setColor(Color.red);
	    
	    if(state.IsStepOn){
		g.drawString("Step Input",x,y);
	    }
	    else{
		
		//MaestroG.subscripter("Pulse:  t","p","",g,12,x+45,y);
                MaestroG.subscripter("Pulse Input","","",g,12,x,y);
                MaestroG.subscripterSerIT("\u03c4","","",g,18,x+45+fm.stringWidth("Pulse:   "),y);
		testperiod = state.RiseTime;
                
                g.setFont(normalfont);
                fm = g.getFontMetrics();
	    
		if(testperiod == 0.0){
		    g.drawString("= 0.0",x+dx,y);	
		    g.drawString("  [ s ])",x+200,y);
		}
	        
		//else if(testperiod < 1.0E-15 && testperiod > 0.0){
		  //  g.drawString("= "+MaestroA.rounder(testperiod*1.0e18,8),x+dx,y);	
		    //g.drawString("  [ as ]",x+200,y);
		//}
		else if(testperiod < 1.0E-12 && testperiod >= 1.0E-16){
		    g.drawString("= "+MaestroA.rounder(testperiod*1.0e15,5),x+dx,y);	
		    g.drawString("  [ fs ]",x+200,y);
		}
		else if(testperiod < 1.0E-9 && testperiod >= 1.0E-12){
		    g.drawString("= "+MaestroA.rounder(testperiod*1.0e12,5),x+dx,y);	
		    g.drawString("  [ ps ]",x+200,y);
		}
		else if(testperiod < 1.0E-6 && testperiod >= 1.0E-9){
		    g.drawString("= "+MaestroA.rounder(testperiod*1.0e9,5),x+dx,y);	
		    g.drawString("  [ ns ]",x+200,y);
		}
		else if(testperiod < 10E-3 && testperiod >= 1.0E-6 ){
		    g.drawString("= "+MaestroA.rounder(testperiod*1.0e6,5),x+dx,y);	
		    g.drawString("  [ \u00b5s ]",x+200,y);
		}
		else if(testperiod < 1.0 && testperiod >= 1.0E-3){
		    g.drawString("= "+MaestroA.rounder(testperiod*1.0e3,4),x+dx,y);	
		    g.drawString("  [ ms ]",x+200,y);
		}
		else if(testperiod >= 1.0){
		    g.drawString("= "+MaestroA.rounder(testperiod,4),x+dx,y);	
		    g.drawString("  [ s ]",x+200,y);
		}   
		
	    }
            //y = 0; // reset vertical coordinate
            
	    y+=dyy;
	    
	    g.setColor(Color.blue.darker());
	    g.drawString("Cursor",x,y);
	    
	    g.setColor(Color.black);
	    g.drawString("z",x+dx-15,y);
            //MaestroG.subscripterSerIT("l",""," - d",g,16,x+dx-33,y);
	    //g.drawString("  [  mm ]",x+200,y);
	    
            g.setFont(normalfont);
	    fm = g.getFontMetrics();
	    
	    testlength = (state.lineLength - state.xpos)/1000;
	    testprint = state.lineLength - state.xpos;
	    if(testlength == 0.0){
		g.drawString("= 0.0",x+dx,y);	
		g.drawString("  [ mm ]",x+200,y);
	    }
	    
	    else if(testlength < 1.0E-9 && testlength > 0.0){
		g.drawString("= "+MaestroA.rounder(testprint*1.0e6,8),x+dx,y);	
		g.drawString("  [ nm ]",x+200,y);
	    }
	    else if(testlength < 1.0E-6 && testlength >= 1.0E-9){
		g.drawString("= "+MaestroA.rounder(testprint*1.0e6,5),x+dx,y);	
		g.drawString("  [ nm ]",x+200,y);
	    }
	    else if(testlength < 1.0E-3 && testlength >= 1.0E-6){
		g.drawString("= "+MaestroA.rounder(testprint*1.0e3,5),x+dx,y);	
		g.drawString("  [ \u00b5m ]",x+200,y);
	    }
	    else if(testlength < 1.0 && testlength >= 1.0E-3){
		g.drawString("= "+MaestroA.rounder(testprint,4),x+dx,y);	
		g.drawString("  [ mm ]",x+200,y);
	    }
	    else if(testlength < 1000.0 && testlength >= 1.0 ){
		g.drawString("= "+MaestroA.rounder(testprint/1000,6),x+dx,y);	
		g.drawString("  [ m ]",x+200,y);
	    }
	    else if(testlength >= 1000.0 && testlength < 1.0E6){
		g.drawString("= "+MaestroA.rounder(testprint/1.0e6,4),x+dx,y);	
		g.drawString("  [ km ]",x+200,y);
	    }
	    else if(testlength >= 1.0E6 && testlength < 1.0E9){
		g.drawString("= "+MaestroA.rounder(testprint/1.0E9,4),x+dx,y);	
		g.drawString("  [ Mm ]",x+200,y);
	    }
	    else if(testlength >= 1.0E9){
		g.drawString("= "+MaestroA.rounder(testprint/1.0E12,4),x+dx,y);	
		g.drawString("  [ Gm ]",x+200,y);
	    }   
	/*
	    //
	    y+=dy;

	   testlength2 = (state.lineLength - state.xpos)/1000/0.0254;
	   
	   if(testlength2 == 0.0){
		g.drawString("= 0.0",x+dx,y);	
		g.drawString("  [ mils ]",x+200,y);
	    }
	        
	    else if(testlength2 < 1.0E-9 && testlength2 > 0.0){
		g.drawString("= "+MaestroA.rounder(testprint/0.0254*1.0e6,8),x+dx,y);	
		MaestroG.superscripter("  [ 10","-6"," mils ]",g,12,x+200,y);
	    }
	    else if(testlength2 < 1.0E-6 && testlength2 >= 1.0E-9){
		g.drawString("= "+MaestroA.rounder(testprint/0.0254*1.0e6,5),x+dx,y);	
		MaestroG.superscripter("  [ 10","-6"," mils ]",g,12,x+200,y);
	    }
	    else if(testlength2 < 1.0E-3 && testlength2 >= 1.0E-6){
		g.drawString("= "+MaestroA.rounder(testprint/0.0254*1.0e3,5),x+dx,y);	
		MaestroG.superscripter("  [ 10","-3"," mils ]",g,12,x+200,y);
	    }
	    else if(testlength2 < 1.0 && testlength2 >= 1.0E-3){
		g.drawString("= "+MaestroA.rounder(testprint/0.0254,5),x+dx,y);	
		g.drawString("  [ mils ]",x+200,y);
	    }
	    else if(testlength2 < 1000.0 && testlength2 >= 1.0 ){
		g.drawString("= "+MaestroA.rounder(testprint/0.0254/1000,5),x+dx,y);	
		MaestroG.superscripter("  [ 10","3"," mils ]",g,12,x+200,y);
	    }
	    else if(testlength2 >= 1000.0 && testlength2 < 1.0E6){
		g.drawString("= "+MaestroA.rounder(testprint/0.0254/1.0e6,4),x+dx,y);	
		MaestroG.superscripter("  [ 10","6"," mils ]",g,12,x+200,y);
	    }
	    else if(testlength2 >= 1.0E6 && testlength2 < 1.0E9){
		g.drawString("= "+MaestroA.rounder(testprint/0.0254/1.0E9,4),x+dx,y);	
		MaestroG.superscripter("  [ 10","9"," mils ]",g,12,x+200,y);
	    }
	    else if(testlength2 >= 1.0E9){
		g.drawString("= "+MaestroA.rounder(testprint/0.0254/1.0E12,4),x+dx,y);	
		MaestroG.superscripter("  [ 10","12"," mils ]",g,12,x+200,y);
	    }   
            
           y+=dyy;
            //----------------------------------------------------------------
           g.drawString("d",x+dx-15,y);
           //MaestroG.subscripterSerIT("","","   d",g,16,x+dx-33,y);
	    //g.drawString("  [  mm ]",x+200,y);
	    
            g.setFont(normalfont);
	    fm = g.getFontMetrics();
	    
	    testlength = (state.xpos)/1000;
	    testprint = state.xpos;
	    if(testlength == 0.0){
		g.drawString("= 0.0",x+dx,y);	
		g.drawString("  [ mm ]",x+200,y);
	    }
	    
	    else if(testlength < 1.0E-9 && testlength > 0.0){
		g.drawString("= "+MaestroA.rounder(testprint*1.0e6,8),x+dx,y);	
		g.drawString("  [ nm ]",x+200,y);
	    }
	    else if(testlength < 1.0E-6 && testlength >= 1.0E-9){
		g.drawString("= "+MaestroA.rounder(testprint*1.0e6,5),x+dx,y);	
		g.drawString("  [ nm ]",x+200,y);
	    }
	    else if(testlength < 1.0E-3 && testlength >= 1.0E-6){
		g.drawString("= "+MaestroA.rounder(testprint*1.0e3,5),x+dx,y);	
		g.drawString("  [ \u00b5m ]",x+200,y);
	    }
	    else if(testlength < 1.0 && testlength >= 1.0E-3){
		g.drawString("= "+MaestroA.rounder(testprint,4),x+dx,y);	
		g.drawString("  [ mm ]",x+200,y);
	    }
	    else if(testlength < 1000.0 && testlength >= 1.0 ){
		g.drawString("= "+MaestroA.rounder(testprint/1000,6),x+dx,y);	
		g.drawString("  [ m ]",x+200,y);
	    }
	    else if(testlength >= 1000.0 && testlength < 1.0E6){
		g.drawString("= "+MaestroA.rounder(testprint/1.0e6,4),x+dx,y);	
		g.drawString("  [ km ]",x+200,y);
	    }
	    else if(testlength >= 1.0E6 && testlength < 1.0E9){
		g.drawString("= "+MaestroA.rounder(testprint/1.0E9,4),x+dx,y);	
		g.drawString("  [ Mm ]",x+200,y);
	    }
	    else if(testlength >= 1.0E9){
		g.drawString("= "+MaestroA.rounder(testprint/1.0E12,4),x+dx,y);	
		g.drawString("  [ Gm ]",x+200,y);
	    }   
	
	    //
	    y+=dy;

	   testlength2 = (state.lineLength - state.xpos)/1000/0.0254;
	   
	   if(testlength2 == 0.0){
		g.drawString("= 0.0",x+dx,y);	
		g.drawString("  [ mils ]",x+200,y);
	    }
	        
	    else if(testlength2 < 1.0E-9 && testlength2 > 0.0){
		g.drawString("= "+MaestroA.rounder(testprint/0.0254*1.0e6,8),x+dx,y);	
		MaestroG.superscripter("  [ 10","-6"," mils ]",g,12,x+200,y);
	    }
	    else if(testlength2 < 1.0E-6 && testlength2 >= 1.0E-9){
		g.drawString("= "+MaestroA.rounder(testprint/0.0254*1.0e6,5),x+dx,y);	
		MaestroG.superscripter("  [ 10","-6"," mils ]",g,12,x+200,y);
	    }
	    else if(testlength2 < 1.0E-3 && testlength2 >= 1.0E-6){
		g.drawString("= "+MaestroA.rounder(testprint/0.0254*1.0e3,5),x+dx,y);	
		MaestroG.superscripter("  [ 10","-3"," mils ]",g,12,x+200,y);
	    }
	    else if(testlength2 < 1.0 && testlength2 >= 1.0E-3){
		g.drawString("= "+MaestroA.rounder(testprint/0.0254,5),x+dx,y);	
		g.drawString("  [ mils ]",x+200,y);
	    }
	    else if(testlength2 < 1000.0 && testlength2 >= 1.0 ){
		g.drawString("= "+MaestroA.rounder(testprint/0.0254/1000,5),x+dx,y);	
		MaestroG.superscripter("  [ 10","3"," mils ]",g,12,x+200,y);
	    }
	    else if(testlength2 >= 1000.0 && testlength2 < 1.0E6){
		g.drawString("= "+MaestroA.rounder(testprint/0.0254/1.0e6,4),x+dx,y);	
		MaestroG.superscripter("  [ 10","6"," mils ]",g,12,x+200,y);
	    }
	    else if(testlength2 >= 1.0E6 && testlength2 < 1.0E9){
		g.drawString("= "+MaestroA.rounder(testprint/0.0254/1.0E9,4),x+dx,y);	
		MaestroG.superscripter("  [ 10","9"," mils ]",g,12,x+200,y);
	    }
	    else if(testlength2 >= 1.0E9){
		g.drawString("= "+MaestroA.rounder(testprint/0.0254/1.0E12,4),x+dx,y);	
		MaestroG.superscripter("  [ 10","12"," mils ]",g,12,x+200,y);
	    }   
	    
            //-----------------------------------------------------------------
	    */
	    g.setColor(Color.white);	   
	    g.drawLine(5,y+dyy/3,getSize().width-5,y+dyy/3);
	    //
	    y += dyy;
	    
	    g.setColor(Color.blue.darker());
	    g.drawString("Transit Time: input to load",x,y);
	    
	    y += dyy-2;
	    g.setColor(Color.black);
	    g.drawString("T",x+dx-15,y);
	    
	    testperiod = state.T_period;
	    
	    if(testperiod == 0.0){
		g.drawString("= 0.0",x+dx,y);	
		g.drawString("  [ s ]",x+200,y);
	    }
	        
	    else if(testperiod < 1.0E-15 && testperiod > 0.0){
		g.drawString("= "+MaestroA.rounder(testperiod*1.0e18,8),x+dx,y);	
		g.drawString("  [ as ]",x+200,y);
	    }
	    else if(testperiod < 1.0E-12 && testperiod >= 1.0E-15){
		g.drawString("= "+MaestroA.rounder(testperiod*1.0e15,5),x+dx,y);	
		g.drawString("  [ fs ]",x+200,y);
	    }
	    else if(testperiod < 1.0E-9 && testperiod >= 1.0E-12){
		g.drawString("= "+MaestroA.rounder(testperiod*1.0e12,5),x+dx,y);	
		g.drawString("  [ ps ]",x+200,y);
	    }
	    else if(testperiod < 1.0E-6 && testperiod >= 1.0E-9){
		g.drawString("= "+MaestroA.rounder(testperiod*1.0e9,5),x+dx,y);	
		g.drawString("  [ ns ]",x+200,y);
	    }
	    else if(testperiod < 10E-3 && testperiod >= 1.0E-6 ) {
		g.drawString("= "+MaestroA.rounder(testperiod*1.0e6,5),x+dx,y);	
		g.drawString("  [ \u00b5s ]",x+200,y);
	    }
	    else if(testperiod < 1.0 && testperiod >= 1.0E-3){
		g.drawString("= "+MaestroA.rounder(testperiod*1.0e3,4),x+dx,y);	
		g.drawString("  [ ms ]",x+200,y);
	    }
	    else if(testperiod >= 1.0){
		g.drawString("= "+MaestroA.rounder(testperiod,4),x+dx,y);	
		g.drawString("  [ s ]",x+200,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.blue.darker());
	    g.drawString("Transit Time: input to cursor position",x,y);
	    
	    y += dyy-2;
	    g.setColor(Color.black);
	    //g.drawString("T",x+dx-15,y);
	    MaestroG.subscripter("T","C","",g,12,x+dx-20,y);
	    
	    testperiod = state.T_period - state.xpos*1.0e-3/state.velocity_phase;
	    
	    if(testperiod == 0.0){
		g.drawString("= 0.0",x+dx,y);	
		g.drawString("  [ s ]",x+200,y);
	    }
	        
	    else if(testperiod < 1.0E-15 && testperiod > 0.0){
		g.drawString("= "+MaestroA.rounder(testperiod*1.0e18,8),x+dx,y);	
		g.drawString("  [ as ]",x+200,y);
	    }
	    else if(testperiod < 1.0E-12 && testperiod >= 1.0E-15){
		g.drawString("= "+MaestroA.rounder(testperiod*1.0e15,5),x+dx,y);	
		g.drawString("  [ fs ]",x+200,y);
	    }
	    else if(testperiod < 1.0E-9 && testperiod >= 1.0E-12){
		g.drawString("= "+MaestroA.rounder(testperiod*1.0e12,5),x+dx,y);	
		g.drawString("  [ ps ]",x+200,y);
	    }
	    else if(testperiod < 1.0E-6 && testperiod >= 1.0E-9){
		g.drawString("= "+MaestroA.rounder(testperiod*1.0e9,5),x+dx,y);	
		g.drawString("  [ ns ]",x+200,y);
	    }
	    else if(testperiod < 10E-3 && testperiod >= 1.0E-6 ){
		g.drawString("= "+MaestroA.rounder(testperiod*1.0e6,5),x+dx,y);	
		g.drawString("  [ \u00b5s ]",x+200,y);
	    }
	    else if(testperiod < 1.0 && testperiod >= 1.0E-3){
		g.drawString("= "+MaestroA.rounder(testperiod*1.0e3,4),x+dx,y);	
		g.drawString("  [ ms ]",x+200,y);
	    }
	    else if(testperiod >= 1.0){
		g.drawString("= "+MaestroA.rounder(testperiod,4),x+dx,y);	
		g.drawString("  [ s ]",x+200,y);
	    }   
	    
	    g.setColor(Color.white);
	    g.drawLine(5,y+dyy/3,getSize().width-5,y+dyy/3);
	    //
	    y += dyy;
	    g.setColor(Color.blue.darker());
	    g.drawString("Transit Time: input to load and back to cursor",x,y);
	    
	    y += dyy-2;
	    g.setColor(Color.black);
	    //g.drawString("T",x+dx-15,y);
	    MaestroG.subscripter("T","LC","",g,12,x+dx-25,y);
	    testperiod = state.T_period + state.xpos*1.0e-3/state.velocity_phase;
	    
	    if(testperiod == 0.0){
		g.drawString("= 0.0",x+dx,y);	
		g.drawString("  [ s ]",x+200,y);
	    }
	        
	    else if(testperiod < 1.0E-15 && testperiod > 0.0){
		g.drawString("= "+MaestroA.rounder(testperiod*1.0e18,8),x+dx,y);	
		g.drawString("  [ as ]",x+200,y);
	    }
	    else if(testperiod < 1.0E-12 && testperiod >= 1.0E-15){
		g.drawString("= "+MaestroA.rounder(testperiod*1.0e15,5),x+dx,y);	
		g.drawString("  [ fs ]",x+200,y);
	    }
	    else if(testperiod < 1.0E-9 && testperiod >= 1.0E-12){
		g.drawString("= "+MaestroA.rounder(testperiod*1.0e12,5),x+dx,y);	
		g.drawString("  [ ps ]",x+200,y);
	    }
	    else if(testperiod < 1.0E-6 && testperiod >= 1.0E-9){
		g.drawString("= "+MaestroA.rounder(testperiod*1.0e9,5),x+dx,y);	
		g.drawString("  [ ns ]",x+200,y);
	    }
	    else if(testperiod < 10E-3 && testperiod >= 1.0E-6 ){
		g.drawString("= "+MaestroA.rounder(testperiod*1.0e6,5),x+dx,y);	
		g.drawString("  [ \u00b5s ]",x+200,y);
	    }
	    else if(testperiod < 1.0 && testperiod >= 1.0E-3){
		g.drawString("= "+MaestroA.rounder(testperiod*1.0e3,4),x+dx,y);	
		g.drawString("  [ ms ]",x+200,y);
	    }
	    else if(testperiod >= 1.0){
		g.drawString("= "+MaestroA.rounder(testperiod,4),x+dx,y);	
		g.drawString("  [ s ]",x+200,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.blue.darker());
	    g.drawString("Phase velocity",x,y);
	
	    //y+=dyy;
	    g.setColor(Color.black);
	    MaestroG.subscripter("u","p","",g,12,x+dx-15,y);
	   
	    g.drawString("= "+MaestroA.rounder(state.velocity_phase*1.0e-8,6),x+dx,y);	
	    MaestroG.superscripter("[ 10","8"," m/s ]",g,12,x+200,y);	    
	    
	    y += 5;
	    
	    g.setColor(Color.white);
	    g.drawLine(5,y+dyy/3,getSize().width-5,y+dyy/3);    
	    y += dyy;
	    
	    g.setColor(Color.blue.darker());
	    g.drawString("Reflection coefficients",x,y);
	    
	    y += dyy-2;
	    g.setColor(Color.black);
	    x=20;
	    MaestroG.subscripter("  ","g","",g,12,x,y);
	    g.drawString("= "+MaestroA.rounder(state.GammaInput,4),x+20,y);
	    g.setFont(symbolfont);
	    g.drawString("\u0393",x,y);
	    g.setFont(normalfont);	
		 
	    //y += dyy-2;
	    g.setColor(Color.black);
	    dx = 160;
	    MaestroG.subscripter("  ","L","",g,12,x+dx-20,y);
	    g.drawString("= "+MaestroA.rounder(state.GammaLoad,4),x+dx,y);	
	    g.setFont(symbolfont);
	    g.drawString("\u0393",x+dx-20,y);
	    g.setFont(normalfont);
	    
	
	}
}
