2023-04-14 11:29:17 +02:00
|
|
|
import java.awt.*;
|
|
|
|
import javax.swing.*;
|
|
|
|
import java.awt.event.*;
|
2023-09-20 11:29:37 +02:00
|
|
|
import java.lang.*
|
2023-04-14 11:29:17 +02:00
|
|
|
|
|
|
|
public class Attente extends JPanel implements WindowListener{
|
|
|
|
|
|
|
|
boolean plan = false;
|
|
|
|
|
|
|
|
public Attente() {
|
|
|
|
super();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void paintComponent(Graphics pinceau) {
|
|
|
|
// obligatoire : on cree un nouveau pinceau pour pouvoir le modifier plus tard
|
|
|
|
Graphics pinceau2 = pinceau.create();
|
|
|
|
if (this.isOpaque()) {
|
|
|
|
// obligatoire : on repeint toute la surface avec la couleur de fond
|
|
|
|
pinceau2.setColor(Color.GREEN);
|
|
|
|
pinceau2.fillRect(0, 0, this.getWidth(), this.getHeight());
|
|
|
|
} if (this.plan==true){
|
|
|
|
pinceau2.setColor(Color.GREEN);
|
|
|
|
pinceau2.fillRect(0, 0, this.getWidth(), this.getHeight());
|
|
|
|
pinceau2.setColor(Color.MAGENTA);
|
|
|
|
pinceau2.fillOval(0, 0, this.getWidth(), this.getHeight());
|
|
|
|
} else{
|
|
|
|
pinceau2.setColor(Color.GREEN);
|
|
|
|
pinceau2.fillRect(0, 0, this.getWidth(), this.getHeight());
|
|
|
|
pinceau2.setColor(Color.MAGENTA);
|
|
|
|
int[] x={0,this.getWidth()/2,this.getWidth(),this.getWidth()/2};
|
|
|
|
int[] y={this.getHeight()/2,0,this.getHeight()/2,this.getHeight()};
|
|
|
|
pinceau2.drawPolygon(x,y,x.length);
|
|
|
|
pinceau2.fillPolygon(x,y,x.length);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void windowDeactivated(WindowEvent evenement){
|
|
|
|
this.plan=false;
|
|
|
|
this.repaint();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void windowActivated(WindowEvent evenement){
|
|
|
|
this.plan=true;
|
|
|
|
this.repaint();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public void windowClosed(WindowEvent evenement){
|
|
|
|
}
|
|
|
|
|
|
|
|
public void windowClosing(WindowEvent evenement){
|
|
|
|
}
|
|
|
|
|
|
|
|
public void windowDeiconified(WindowEvent evenement){
|
|
|
|
}
|
|
|
|
|
|
|
|
public void windowIconified(WindowEvent evenement){
|
|
|
|
}
|
|
|
|
|
|
|
|
public void windowOpened(WindowEvent evenement){
|
|
|
|
}
|
|
|
|
}
|