package calculette;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.ActionListener;

import javax.swing.JButton;

@Exercice(3)
public class Touche extends JButton{
	public final static long serialVersionUID = 1L;
	
	public char ct;
	
	Touche(char c,ActionListener ac){
		super(String.valueOf(c));
		ct=c;
        //exo 4
		  setOpaque(true);
		  setBackground(Color.WHITE);
		addActionListener(ac);
	}

	@Override
	protected void paintComponent(Graphics g){
		super.paintComponent(g);
        //exo 4
		int c=getWidth() , l=getHeight();
		g.setColor(Color.BLUE);
		g.fillOval(8, 8, c-16, l-16);
		g.setColor(Color.WHITE);
		g.drawString(getText(), c/2-3, l/2+5);
	}
}
