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

public class Reset 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 int SCROLLMIN=0, SCROLLMAX=30;
    public Scrollbar slider1;
    
    private Graphics buf;
    
        
    public Reset(){
	super();
        setLayout(null);
	setBackground(bgcolor);
        
        b1 = new Button("Reset");
        b1.setBackground(Color.white);
	add(b1);
	b1.setBounds(5,25,50,18);
        
        slider1 = new Scrollbar(Scrollbar.HORIZONTAL,1,1,SCROLLMIN,SCROLLMAX);
	slider1.setBounds(5,5,80,15);
        slider1.setBackground(Color.white);
        slider1.setValue(7);
	add(slider1);
        
        Panel pslid1 = new Panel();
            pslid1.setBackground(Color.black);
            add(pslid1);
            pslid1.setBounds(4,4,82,17);
                
	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(5,2,15,20);
        Hbox.setBounds(65,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,20,15);
        g.setColor(Color.blue);
	//MaestroG.subscripterSansItalic3("E","y","( t )",g,12,80,15);
        
        double f_normalized;
        int x, y, dx;
	x = 90;
        y = 18;
        dx = 3;
        g.setColor(Color.blue);
        g.drawLine(x,y,x,y-2);
        x+=dx;
        g.drawLine(x,y,x,y-7);
        x+=dx;
        g.drawLine(x,y,x,y-10);
        x+=dx;
        g.drawLine(x,y,x,y-11);
        x+=dx;
        g.drawLine(x,y,x,y-10);
        x+=dx;
        g.drawLine(x,y,x,y-7);
        x+=dx;
        g.drawLine(x,y,x,y-2);
        
                           
    }
}