31 lines
925 B
Java
31 lines
925 B
Java
//MELIANI SAMY (TP1)
|
|
import java.awt.Color;
|
|
import java.awt.Graphics;
|
|
import javax.swing.JComponent;
|
|
|
|
public class Debut2 extends JComponent {
|
|
private int rayon;
|
|
public Debut2(){
|
|
super();
|
|
rayon = 60;
|
|
}
|
|
|
|
public void getrayon(int radius){
|
|
this.rayon=radius;
|
|
this.repaint();
|
|
}
|
|
|
|
@Override
|
|
public void paintComponent(Graphics pinceau){
|
|
Graphics secondPinceau=pinceau.create();
|
|
if(this.isOpaque()){
|
|
secondPinceau.setColor(this.getBackground());
|
|
secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight());
|
|
}
|
|
secondPinceau.setColor(new Color(115,194,251));
|
|
secondPinceau.fillRect(0,0,this.getWidth(),this.getHeight());
|
|
secondPinceau.setColor(Color.YELLOW);
|
|
secondPinceau.fillOval((this.getWidth()/2)-(this.rayon/2), (this.getHeight())-(this.rayon/2), this.rayon, this.rayon);
|
|
}
|
|
}
|