DEV_BUT1/DEV2.1/TP08/Attente.java
2023-04-04 14:03:16 +02:00

34 lines
754 B
Java

import javax.swing.*;
import java.awt.*;
class Dessin extends JComponent implements WindowListener{
private Image pingouin;
public Dessin(){
super();
this.pingouin = Toolkit.getDefaultToolkit().getImage("logo.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.setColor(Color.GREEN);
secondPinceau.fillOval(200,200,100,100);
}
public void windowDeactivated(WindowEvent e){
secondPinceau.drawImage(this.pingouin, 150, 125, this);
}
}
public class Attente{
public static void main(String[] args) {
}
}