BUT2/DEV/DEV2.1/CM1/Q4_Debut/Soleil.java

24 lines
647 B
Java
Raw Permalink Normal View History

2023-10-23 13:23:36 +02:00
//Wamster Alexis
import javax.swing.JComponent;
import java.awt.*;
public class Soleil extends JComponent {
private ActionSouris detectClic;
public Soleil(ActionSouris detectClic){
this.detectClic = detectClic;
}
@Override
protected void paintComponent(Graphics pinceau) {
Graphics secondPinceau = pinceau.create();
secondPinceau.setColor(new Color(115,194,251));
secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight());
int rayon = detectClic.RecupereRayon();
secondPinceau.setColor(Color.YELLOW);
secondPinceau.fillOval(this.getWidth()/2-rayon,this.getHeight()-rayon, rayon*2, rayon*2);
}
}