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

23 lines
667 B
Java

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);
for (int i=0; i<5; i++) {
for (int j=0; j<5; j++) {
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);
}
}
}
}