//TimeChoicePanel.java
/* 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.*;

public class TimeChoicePanel extends Panel implements ItemListener{ 
	public Button button1, button2, button3;
        public boolean IsButtonOne, IsButtonTwo, IsButtonThree, IsEnvelope;
	
	private static final Color bgcolor = Color.white; 
        
	private static final Color tinta = new Color(236,236,221);
        Font bfont;
        public static Font labfont;
        Trans_State state;
        
	public TimeChoicePanel(Trans_State state){
		super();
                this.state = state;
		setLayout(null);
		setBackground(bgcolor);
		Font bfont = new Font("Sanserif",Font.PLAIN,state.font9);
        
		button1 = new Button("Incident");
		button2 = new Button("Reflected");
                button3 = new Button("Total");

                add(button1); add(button2); add(button3); 
		button1.setFont(bfont);
                button2.setFont(bfont);
                button3.setFont(bfont);
                
                button1.setBounds(state.s7,state.s3,state.s65,state.s15);
                Panel pbutton1 = new Panel();
		    pbutton1.setBackground(Color.gray);
		    add(pbutton1);
		    pbutton1.setBounds(state.s7-1,state.s3-1,state.s65+2,state.s15+2);
                
                button2.setBounds(state.s7,state.s24,state.s65,state.s15);
                Panel pbutton2 = new Panel();
		    pbutton2.setBackground(Color.gray);
		    add(pbutton2);
		    pbutton2.setBounds(state.s7-1,state.s24-1,state.s65+2,state.s15+2);
                
                button3.setBounds(state.s7,state.s45,state.s65,state.s15);
                Panel pbutton3 = new Panel();
		    pbutton3.setBackground(Color.gray);
		    add(pbutton3);
		    pbutton3.setBounds(state.s7-1,state.s45-1,state.s65+2,state.s15+2);
                
                IsButtonOne = false;
                IsButtonTwo = false;
                IsButtonThree = true; 
                IsEnvelope = true;
	}
        
	public void paint(Graphics g){
            
            //g.setColor(Color.black);
            //g.drawRect(0,0,getSize().width-1,getSize().height-1);
            
            g.setFont(labfont);
            g.setColor(Color.black);
            g.setColor(Color.red);
	    if(IsButtonOne){
                g.fillRect(0,state.s7,state.s4,state.s4);
            }
            else if(IsButtonTwo){
                g.fillRect(0,state.s28,state.s4,state.s4);
            }
            else if(IsButtonThree){
                g.fillRect(0,state.s49,state.s4,state.s4);
            }
	}
        public void itemStateChanged(ItemEvent evt){
            
        }

} // TimeChoicePanel.java
