Bonjour,
J'ai plusieurs méthodes que je dois appeler les unes à la suite des autres. J'ai utilisé la méthode "Thread.join()" de chacun de mes traitements mais je ne sais pas si c'est la bonne façon de faire.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
 
JDialog d = new JDialog(); //qui contient une progress bar
final SwingWorker<Void, Void> s = new SwingWorker<Void, Void>(){
           protected Void doInBackground() throws Exception {
	          Thread t1 = new Thread(new Runnable() {
		      public void run() {
                             LANCEMENT D'UN MOTEUR DE CALCUL //qui génére un fichier
	              }
                  });
		   Thread t2 = new Thread(new Runnable() {
		        public void run() {
			        boolean fileFound = false;
				 while(!fileFound) {
				         try {
					      fileFound = isFileResultatExist();
					      Thread.sleep(4000);
					  } catch (Exception ex) { }
				}
			}
		     });
		     Thread t3 = new Thread(new Runnable() {
		          public void run() {
			       CHARGEMENT DES RESULTATS
		          }
		     });
 
                     t1.start();
		     t1.join();
	             t2.start();
		     t2.join();
		     t3.start();
		     t3.join();
		     return null;
	     }
	      protected void done() {
		      d.dispose(); //JDialog avec une progress bar
              }
    };
  s.execute();
  d.setVisible(true);
Si quelqu'un pouvait me dire ce qu'il en pense ; ou si la façon de faire est bonne ou pas.
Merci