//TransGeneratorPanel
/* A Java class for
 * LossyWide.java
 * Electromagnetic Transmission Line Applet
 * Applet without Smith Chart - Prepared by Umberto Ravaioli 
 * for 6th edition of Fundamentals of Applied Electromagnetics Book
 * May 2009 - All Rights Reserved
 */ 
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.lang.*;


public class TransGeneratorPanel extends PC{
   
    protected CheckboxGroup cgrp;
    private Trans_State state;
    //private static final Color bgcolor = new Color(216,216,191);
    private static final Color bgcolor = new Color(236,236,236);
    private static final Color tinta = new Color(236,236,236);
    //private static final Color bgcolor = new Color(200,200,200);
    
    public TransGeneratorPanel(String titulo, String[] nome, String[] unidade, Trans_State state){
	
	super(titulo,nome,unidade);
	setLayout(null);
	setBackground(bgcolor);
	this.state = state;
	
	titlelabel.setBounds(5,15,280,30);
	//lab1[0].setBounds(30,50,20,20);
	text1[0].setBounds(55,50,80,20);
	
	lab2[0].setBounds(140,50,20,20);
	text2[0].setBounds(170,50,80,20);
	
	lab3[0].setBounds(255,50,25,20);
	
	//lab1[1].setBounds(30,80,20,20);
	text1[1].setBounds(55,80,80,20);
	
	lab2[1].setBounds(140,80,20,20);
	text2[1].setBounds(170,80,80,20);
	
	lab3[1].setBounds(255,80,25,20);
	
	b1.setBounds(120,110,70,20);
        //b1.setBackground(new Color(220,220,210));
        b1.setBackground(Color.white);
        	
	text1[0].setText(""+state.ZL.Real());
	text2[0].setText(""+state.ZL.Imaginary());
    
    }
    
    public void paint(Graphics g){
	    
                Graphics2D g2d = (Graphics2D)g;
                g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
                
            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);
	    
	    g.setColor(Color.black);	   
	    MaestroG.subscripterWavy("V","g"," =",g,12,20,65);
	    MaestroG.subscripter("Z","g"," =",g,12,20,95);
            
            g.setColor(Color.red.darker());
            g.drawRect(52,47,84,25);
            g.drawRect(167,47,84,25);
            g.drawRect(52,77,84,25);
            g.drawRect(167,77,84,25);
            
            g.drawRect(117,107,75,25);

    }
    
}