This commit is contained in:
2023-04-04 14:03:16 +02:00
parent 7021891e9c
commit e32d4de827
111 changed files with 1928 additions and 6 deletions

Binary file not shown.

View File

@@ -0,0 +1,35 @@
import javax.swing.*;
import java.awt.*;
public class Sablier extends JComponent{
private int[] xPoints;
private int[] yPoints;
private int[] yPoints2;
public Sablier(){
super();
this.xPoints[0] = 0;
this.xPoints[1] = this.getWidth()/2;
this.xPoints[2] = this.getWidth();
this.yPoints[0] = 0;
this.yPoints[1] = this.getHeight()/2;
this.yPoints[2] = 0;
this.yPoints2[0] = this.getHeight();
this.yPoints2[1] = this.getHeight()/2;
this.yPoints2[2] = this.getHeight();
}
@Override
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.setColor(Color.CYAN);
secondPinceau.drawPolygon(xPoints, yPoints, 3);
secondPinceau.fillPolygon(xPoints, yPoints, 3);
secondPinceau.drawPolygon(xPoints, yPoints2, 3);
secondPinceau.fillPolygon(xPoints, yPoints2, 3);
}
}

Binary file not shown.

View File

@@ -0,0 +1,17 @@
import javax.swing.*;
import java.awt.*;
public class Sautoir{
public static void main(String[] args) {
JFrame fenetre = new JFrame();
fenetre.setSize(800, 800);
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
GridLayout grille = new GridLayout(5,5);
Sablier cadre = new Sablier();
for (int i=0; i<24; i++){
fenetre.add(cadre);
}
fenetre.setVisible(true);
}
}