APL/APL2.1/TP6/Sautoir/Paintsablier.java

23 lines
667 B
Java
Raw Normal View History

2022-02-14 11:02:04 +01:00
import javax.swing.*;
import java.awt.*;
public class Paintsablier extends JComponent {
private Image image;
public Paintsablier() {
super();
}
@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);
2022-02-14 16:11:04 +01:00
for (int i=0; i<5; i++) {
for (int j=0; j<5; j++) {
2022-02-14 11:02:04 +01:00
secondPinceau.fillPolygon(new int[] {25+i*50,50+i*50,25+i*50,0+i*50},new int[] {-25+j*50,0+j*50,25+j*50,0+j*50},4);
}
}
}
}