Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionpublic class Fenetre extends JFrame implements Runnable { public static void main(String[] args) { System.out.println("lancement des threads"); new Thread(new Fenetre()).start(); new Thread(new Fenetre()).start(); new Thread(new Fenetre()).start(); new Thread(new Fenetre()).start(); System.out.println("lancement terminé"); } public Fenetre() { super(); getContentPane().add(new JTextArea(2, 13)); pack(); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent Evenement) { System.out.println("c'est la fin. fermeture de la fenêtre"); } }); } public void run() { setVisible(true); } }
public synchronized void setFin(boolean fin){ this.fin=fin;//le boolean fin ne doit pas être static !!! } public synchronized boolean getFin(){ return fin; }