SAE21_2021/Etoile.java

19 lines
640 B
Java
Raw Normal View History

2022-04-26 10:42:13 +02:00
import javax.swing.JComponent;
import java.awt.*;
2022-04-27 16:16:34 +02:00
// Création d'un Jcomponent Etoile, qui sert pour le marquage des mines
2022-04-26 10:42:13 +02:00
public class Etoile extends JComponent {
2022-04-27 16:16:34 +02:00
private Image etoileImage;
2022-04-29 10:03:05 +02:00
private Dimension caseSize;
public Etoile(Dimension caseSize) {
2022-04-27 16:16:34 +02:00
super();
2022-04-29 10:03:05 +02:00
this.caseSize=caseSize;
2022-04-27 16:16:34 +02:00
this.etoileImage = Toolkit.getDefaultToolkit().getImage("etoile.png");
}
2022-04-26 10:42:13 +02:00
@Override
protected void paintComponent(Graphics pinceau) {
Graphics etoile = pinceau.create();
2022-04-29 10:03:05 +02:00
etoile.drawImage(this.etoileImage,this.caseSize.width*1/20,this.caseSize.height*1/10,this.caseSize.width*9/10,this.caseSize.height*8/10,this);
2022-04-26 10:42:13 +02:00
}
}