import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

public class Attente {
	public static void main(String[] args) {
		JFrame fenetre = new JFrame();
		fenetre.setSize(300,200);
		fenetre.setLocation(100,100);
		fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		fenetre.setLayout(new GridLayout(1, 1));

		JPanel panneau = new JPanel();


		panneau.setLayout(new BorderLayout());
		panneau.setBackground(Color.GREEN);
		FenetreListener listener = new FenetreListener();
		fenetre.addWindowListener(listener);
		fenetre.add(panneau);

		if (listener.getEstActive()) {
			System.out.println("Fenetre activée");
			panneau.add(new CercleMagenta());
			fenetre.repaint();
		}
		else {
			System.out.println("Fenetre désactivée");
			panneau.add(new Sautoir());
			fenetre.repaint();
		}

		fenetre.setVisible(true);
	}
}