import javax.swing.*; import java.io.File; public class FileImport { private String ce_chemin; public FileImport(){ this.ce_chemin = ""; }; public String Parcours(){ JFileChooser fileChooser = new JFileChooser(); int option = fileChooser.showOpenDialog(null); if (option == JFileChooser.APPROVE_OPTION) { File selectedFile = fileChooser.getSelectedFile(); this.ce_chemin = selectedFile.getAbsolutePath(); } else { System.out.println("No file selected"); } return this.ce_chemin; } }