2023-04-18 12:29:43 +02:00
|
|
|
import javax.swing.*;
|
|
|
|
import java.io.File;
|
|
|
|
|
|
|
|
public class FileImport {
|
2023-04-19 19:13:00 +02:00
|
|
|
private String ce_chemin;
|
2023-04-28 19:17:35 +02:00
|
|
|
|
2023-04-18 12:29:43 +02:00
|
|
|
public FileImport(){
|
|
|
|
this.ce_chemin = "";
|
2023-04-28 19:17:35 +02:00
|
|
|
}
|
|
|
|
|
2023-04-19 19:13:00 +02:00
|
|
|
public String Parcours(){
|
2023-04-18 12:29:43 +02:00
|
|
|
JFileChooser fileChooser = new JFileChooser();
|
2023-04-28 19:17:35 +02:00
|
|
|
|
|
|
|
try {
|
|
|
|
int option = fileChooser.showOpenDialog(null);
|
|
|
|
if (option == JFileChooser.APPROVE_OPTION) {
|
|
|
|
File selectedFile = fileChooser.getSelectedFile();
|
|
|
|
this.ce_chemin = selectedFile.getAbsolutePath();
|
|
|
|
} else {
|
|
|
|
System.out.println("Aucun fichier sélectionné");
|
|
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
|
|
System.out.println("Voici l'eereur rencontrée: " + e.getMessage());
|
|
|
|
this.ce_chemin = "";
|
2023-04-18 12:29:43 +02:00
|
|
|
}
|
2023-04-28 19:17:35 +02:00
|
|
|
|
2023-04-18 12:29:43 +02:00
|
|
|
return this.ce_chemin;
|
|
|
|
}
|
2023-04-28 19:17:35 +02:00
|
|
|
}
|