SAE21_2021/Entourage.java

21 lines
631 B
Java
Raw Normal View History

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