apl/APL2.1/TP6_Dessin/panelAttente.java

29 lines
702 B
Java
Raw Permalink Normal View History

2022-01-14 06:54:18 +01:00
import java.awt.*;
import javax.swing.*
public class panelAttente extends JPanel{
int rayonCercle;
int positionCentreX;
int positionCentreY;
public panelAttente(int rayonCercle){
super();
this.rayonCercle=rayonCercle;
this.getCenter();
}
public Position getCenter(){
this.positionCentreX = this.getWidth()/2;
this.positionCentreY = this.getHeight()/2);
}
protected void paintComponent(Graphics pinceau){
Graphics secondPinceau = pinceau.create();
if (this.isOpaque()) {
secondPinceau.setColor(this.getBackground());
secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight());
}
secondPinceau.drawOval(this.positionCentreX, this.positionCentreY,200, 200);
}
}