43 lines
1.2 KiB
Java
43 lines
1.2 KiB
Java
|
import javax.swing.*;
|
||
|
import java.awt.*;
|
||
|
|
||
|
public class CrocsCars extends JComponent{
|
||
|
|
||
|
private Image pingouin;
|
||
|
|
||
|
public CrocsCars(){
|
||
|
super();
|
||
|
this.pingouin = Toolkit.getDefaultToolkit().getImage("tuile.png");
|
||
|
}
|
||
|
@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.drawImage(this.pingouin, 0, 0,this);
|
||
|
secondPinceau.drawImage(this.pingouin, 512, 0,this);
|
||
|
secondPinceau.drawImage(this.pingouin, 0, 512,this);
|
||
|
secondPinceau.drawImage(this.pingouin, 512, 512,this);
|
||
|
|
||
|
if(this.getHeight() >= 1024){
|
||
|
secondPinceau.drawImage(this.pingouin, 0, 1024,this);
|
||
|
secondPinceau.drawImage(this.pingouin, 512, 1024,this);
|
||
|
if(this.getWidth() >= 1024){
|
||
|
secondPinceau.drawImage(this.pingouin, 1024, 1024,this);
|
||
|
|
||
|
}
|
||
|
if(this.getWidth() >= 1024){
|
||
|
secondPinceau.drawImage(this.pingouin, 1024, 0,this);
|
||
|
secondPinceau.drawImage(this.pingouin, 1024, 512,this);
|
||
|
if(this.getHeight() >= 1024){
|
||
|
secondPinceau.drawImage(this.pingouin, 1024, 1024,this);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|