SAE21_2021/MineLeft.java

22 lines
708 B
Java
Raw Normal View History

2022-05-05 22:29:04 +02:00
import javax.swing.JComponent;
import java.awt.*;
public class MineLeft extends JComponent {
private int minesLeft;
private Dimension banniereSize;
public MineLeft(int minesLeft, Dimension banniereSize) {
super();
this.minesLeft = minesLeft;
this.banniereSize=banniereSize;
}
@Override
protected void paintComponent(Graphics pinceau) {
2022-05-05 23:13:52 +02:00
this.setSize(banniereSize);
2022-05-05 22:29:04 +02:00
Graphics chiffre = pinceau.create();
2022-05-17 11:11:29 +02:00
Font font = new Font("Arial", Font.BOLD, banniereSize.width/50);
2022-05-05 23:13:52 +02:00
chiffre.setFont(font);
chiffre.setColor(new Color(0, 22, 236));
2022-05-17 20:53:21 +02:00
chiffre.drawString("Mines restantes : "+Integer.toString(this.minesLeft),banniereSize.width/100,banniereSize.height*2/3);
2022-05-05 22:29:04 +02:00
}
}