//TransGeneratorPanel
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);
    protected static final Font titfont = new Font("SanSerif",Font.PLAIN,14);
    //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);
        //titlelabel.setForeground(Color.black);
        titlelabel.setBounds(15,5,200,20);
        titlelabel.setForeground(Color.red.darker());
        titlelabel.setFont(titfont);
        
	//lab1[0].setBounds(30,50,20,20);
	text1[0].setBounds(55,50,80,20);
	
	lab2[0].setBounds(145,50,20,20);
	text2[0].setBounds(170,50,80,20);
	
	lab3[0].setBounds(255,50,40,20);
	
	//lab1[1].setBounds(30,80,20,20);
	text1[1].setBounds(55,80,80,20);
	
	lab2[1].setBounds(145,80,20,20);
	text2[1].setBounds(170,80,80,20);
	
	lab3[1].setBounds(255,80,40,20);
	
	b1.setBounds(120,110,70,20);
	b1.setBackground(bgcolor);
        
	text1[0].setText(""+state.ZL.Real());
	text2[0].setText(""+state.ZL.Imaginary());
    
    }
    
    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);
	    
	    g.setColor(Color.black);
            //CHANGE #1 6/13/2017 ==============================================
            // MODIFY LINE BELOW
	    //MaestroG.subscripter("V","g"," =",g,12,25,65);
            MaestroG.subscripter("V","g"," =",g,12,20,65);
            //==================================================================
            
            FontMetrics fm;
            fm = g.getFontMetrics();
            int goup = fm.getHeight();
            //CHANGE #2 6/13/2017 ==============================================
            // MODIFY LINES BELOW
	    //MaestroG.subscripter("~","","",g,13,25,65-90*goup/200);
	    //MaestroG.subscripter("Z","g"," =",g,12,25,95);
            MaestroG.subscripter("~","","",g,13,20,65-120*goup/200);
	    MaestroG.subscripter("Z","g"," =",g,12,20,95);
            //==================================================================
            
            g.setColor(Color.red.darker());
            g.drawRect(52,47,84,24);
            g.drawRect(167,47,84,24);
            g.drawRect(52,77,84,24);
            g.drawRect(167,77,84,24);
            
            g.drawRect(117,107,74,24);
    }
    
}