BOnsoir,

Désolé pour la récurrence du problème , j'ai trouvé pas mal de doc sur les ProgressBar donc la mienne est exactement comme je le souhaite quand je la lance dans l'EDT mais pas dans un nouveau thread, elle freeze le temps de mes calculs dans l'EDT . Bref, je vois vraiment pas ce qui cloche :

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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
public static void ChargeFichier(){
		//maliste2.clear();
		//Progression prgs= new Progression();
		//prgs.go();
		final JFileChooser chooser = new JFileChooser();
		chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
		chooser.setMultiSelectionEnabled(true);
		final int valRetour = chooser.showOpenDialog(null);
        new Thread() {
            public void run() {
 
                System.out.println("Debut du traitement dans le thread : "
                        + Thread.currentThread().getName());
             	new JProgress2();
                System.out.println("Fin du traitement dans le thread : "
                        + Thread.currentThread().getName());
 
                // On utilise invokeLater pour exécuter du code dans l'EDT :
                SwingUtilities.invokeLater(new Runnable() {
                    @Override
                    public void run() {
 
                		if(valRetour == JFileChooser.APPROVE_OPTION){
                			File  fs = chooser.getSelectedFile();
                			File [] fichiers = fs.listFiles();
 
                			nom_fich = fichiers[0].getAbsolutePath().replaceAll(fichiers[0].getAbsolutePath().split("\\\\")[fichiers[0].getAbsolutePath().split("\\\\").length-1], "");
                			nom_fich2 = nom_fich.replaceAll(nom_fich.split("\\\\")[nom_fich.split("\\\\").length-1],"");
                			nom_fich2 = nom_fich2.replaceAll("\\\\\\\\", "\\\\");
                			//	System.out.println(nom_fich);
                			//	System.out.println(nom_fich2);
                			for(int i=0;i<fichiers.length;i++){
                				//Progression.augmentation = i;
                				String s = fichiers[i].getAbsolutePath();
                				//System.out.println(s);
                				analyse_fichier(s);
                			}
                		}
                		Log.init();
                		create_dir();
                		try
                		{
                			String adresse = System.getProperty("user.dir") + "/" + "path.txt";
                			File f = new File(System.getProperty("user.dir") + "/" + "path.txt");
                			if(!f.exists()){
                				FileWriter fw = new FileWriter(adresse, true);		
                				BufferedWriter output = new BufferedWriter(fw);
                				output.write(nom_fich);
                				output.flush();
                				output.close();
                			}
                		}
                		catch(IOException ioe){
                			System.out.print("Erreur : ");
                			ioe.printStackTrace();
                		}
                         System.out.println("Fin du traitement dans invokeLater : " + Thread.currentThread().getName());
                        // On restaure l'état de notre interface
                    }
                });
 
            }
        }.start();
 
		//Progression.cadre.dispose();
	}