This commit is contained in:
2023-03-27 11:28:45 +02:00
parent d14f7c23c6
commit 0c873faeb2
15 changed files with 92 additions and 4 deletions

View File

@@ -4,7 +4,18 @@ import java.awt.*;
public class Sautoir extends JComponent{
protected void paintComponent(Graphics pinceau) {
// obligatoire : on crée un nouveau pinceau pour pouvoir le modifier plus tard
Graphics pinceau = pinceau.create();
pinceau.setColor(Color.CYAN);
pinceau.fillPolygon([0,0],[50,0],3);
// obligatoire : on cree un nouveau pinceau pour pouvoir le modifier plus tard
Graphics pinceau2 = pinceau.create();
if (this.isOpaque()) {
// obligatoire : on repeint toute la surface avec la couleur de fond
pinceau2.setColor(this.getBackground());
pinceau2.fillRect(0, 0, this.getWidth(), this.getHeight());
}
pinceau2.setColor(Color.CYAN);
int[] x={0, getWidth()/2, getWidth()};
int[] yt={0, getHeight()/2, 0};
pinceau2.fillPolygon(x,yt,3);
int[] yb={ getHeight(), getHeight()/2, getHeight()};
pinceau2.fillPolygon(x,yb,3);
}
}