2022-04-29 10:03:05 +02:00
|
|
|
import javax.swing.JComponent;
|
|
|
|
import java.awt.*;
|
|
|
|
|
|
|
|
public class Chiffre extends JComponent {
|
|
|
|
private int entourage;
|
|
|
|
private Dimension caseSize;
|
|
|
|
public Chiffre(int entourage, Dimension caseSize) {
|
|
|
|
super();
|
|
|
|
this.entourage = entourage;
|
|
|
|
this.caseSize=caseSize;
|
|
|
|
}
|
|
|
|
@Override
|
|
|
|
protected void paintComponent(Graphics pinceau) {
|
|
|
|
Graphics chiffre = pinceau.create();
|
2022-04-29 10:57:59 +02:00
|
|
|
Font font = new Font("Arial", Font.BOLD, caseSize.width*2/5);
|
2022-04-29 10:03:05 +02:00
|
|
|
chiffre.setFont(font);
|
|
|
|
Color jaune = new Color(236, 214, 0);
|
|
|
|
chiffre.setColor(jaune);
|
2022-04-29 10:57:59 +02:00
|
|
|
chiffre.drawString(Integer.toString(this.entourage),caseSize.width*2/5,caseSize.height*3/5);
|
2022-04-29 10:03:05 +02:00
|
|
|
}
|
|
|
|
}
|