34 lines
754 B
Java
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) {
|
|
|
|
}
|
|
|
|
} |