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

public class FieldOn extends Panel{
    //private static final Color bgcolor = Color.lightGray;
    private static final Color bgcolor = Color.white;
    public Checkbox Ebox, Hbox;
    public Button b1;
    //public double frequency;
    public int CurrentTime, TotalTime;
    private Image im;
    private Graphics buf;
    
        
    public FieldOn(){
	super();
        setLayout(null);
	setBackground(bgcolor);
        
        b1 = new Button("Reset");
        b1.setBackground(Color.white);
	add(b1);
	b1.setBounds(5,25,50,18);
                
	Ebox = new Checkbox("",null,true);
        Hbox = new Checkbox("",null,true);
        add(Ebox);
	Ebox.setBackground(bgcolor);
        Ebox.setForeground(Color.red);
        
        add(Hbox);
	Hbox.setBackground(bgcolor);       
        Hbox.setForeground(Color.blue);
        
        Ebox.setBounds(35,2,15,20);
        Hbox.setBounds(105,2,15,20);
        //frequency = 1.0E9;
        CurrentTime = 0;
        TotalTime = 0;
    }
    
    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){
	g.setColor(bgcolor);	
	g.fillRect(0,0,getSize().width-1,getSize().height-1);  
        
        Graphics2D g2d = (Graphics2D)g;
        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
        
        g.setColor(Color.red);
        MaestroG.subscripterSansItalic3("E","x","( t )",g,12,50,14);
        g.setColor(Color.blue);
	MaestroG.subscripterSansItalic3("H","y","( t )",g,12,120,14);
        
        double f_normalized;
        int x, y;
	x = 8;
        y = 40;
                           
    }
}