This commit is contained in:
Simoes Lukas
2025-03-27 13:35:54 +01:00
parent 376861b608
commit fe693705bf
90 changed files with 1188 additions and 24 deletions

View File

@@ -0,0 +1,28 @@
import java.awt.*;
import javax.swing.*;
public class Polygone extends JComponent {
private int[] coordX;
private int[] coordY;
private int nbPoints;
public Polygone(int[] coordX, int[] coordY, int nbPoints) {
this.coordX = coordX;
this.coordY = coordY;
this.nbPoints = nbPoints;
}
@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(Color.BLUE);
secondPinceau.fillPolygon(this.coordX, this.coordY, this.nbPoints);
}
}