23 lines
706 B
Java
23 lines
706 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<(this.getWidth()/50); i++) {
|
||
|
for (int j=0; j<(this.getHeight()/50); 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);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|