import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.awt.image.*;
import java.util.*;

//import maestro.lib.math.*;

public class Current extends Panel implements ActionListener{
    
    //private static final Color bgcolor = new Color(236,236,236);
    private static final Color bgcolor = Color.white;
    private static final Font labfont=new Font("SanSerif",Font.PLAIN,12);
    private static final Font symbolfont = new Font("Symbol",Font.PLAIN,12);
    private static final Font normalfont = new Font("SanSerif",Font.PLAIN,12);
    private static final Font normalfont2 = new Font("SanSerif",Font.PLAIN,16);
    private static final Font centerfont = new Font("SanSerif",Font.BOLD,12);
    private static final Font centerfont2 = new Font("SanSerif",Font.BOLD,16);
        
    private static final Font textfont = new Font("SanSerif",Font.PLAIN,14);
    
    private static final Font font_one = new Font("Serif",Font.PLAIN,20);
    private static final Font font_two = new Font("Serif",Font.PLAIN,40);
    
    public TextField epsilon;
    private Paint paint;
    
    public Button bupdate;
    private Image im, image, image2, image3, image4, image8;
    private Graphics buf;
    
    private Trans_State state;
    
    public Current(Image image8, Trans_State state){
	super();
        this.state = state;
	setLayout(null);
	setBackground(bgcolor);
	this.image8 = image8;
        
	// update button
	bupdate = new Button("CLOSE");
        bupdate.setBackground(new Color(240,240,255));
	//add(bupdate);
	bupdate.setBounds(240,150,70,27);	
        Panel ps7 = new Panel();
	    ps7.setBackground(Color.lightGray);
	    //add(ps7);
	    ps7.setBounds(239,149,72,29);
	    
	Panel ps8 = new Panel();
	    ps8.setBackground(Color.black);
	    //add(ps8);
	    ps8.setBounds(238,148,74,31);
	
	//Listeners
	bupdate.addActionListener(this);
    }
    
    public void paint(Graphics g){
            
	    if(im == null){
		im = createImage(getSize().width,getSize().height);
		buf = im.getGraphics();
		drawCanvas(buf);
	    }
	    else{
		drawCanvas(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 clear(){
	    this.getGraphics().clearRect(0,0,getSize().width,getSize().height);
	    repaint();
    }
    
    public void drawCanvas(Graphics g){
        FontMetrics fm;
        String temp_zero, temp_one, temp_two, temp_three, temp_four, temp_five, temp_six, temp_seven, temp_sevenB;
        Graphics2D g2d = (Graphics2D)g;
        
        Color bluecenter = Color.blue.darker();
        
        g.setFont(font_one);
        fm = g.getFontMetrics();
       
        //g.setColor(Color.blue.darker());
        //g.drawImage(image8,10,30,this);
        //MaestroG.fillCircle(100,100,100,g);
        double sep = 50.0;
        double radius = 50.0;
        double x_center = getSize().width/2.0;
        double y_center = getSize().height/2.0 - sep;
        MaestroG.fillCircleThick(g, x_center, y_center, radius, 2, Color.red);
        System.out.println(state.Dipole_Current);
    }
    
    
//----------------------------------------------------------------------------------------

public void actionPerformed(ActionEvent evt){
    
    if(evt.getSource()==bupdate){
	
    }  
} 
 
//----------------------------------------------------------------------------------------    
}//End
    

