private void enregistrer(File fichier){ try { JFileChooser filechoose = new JFileChooser(); filechoose.setCurrentDirectory(new File(".")); String approve = new String(ienregistrer); int resultatEnregistrer = filechoose.showDialog(filechoose, approve); // Pour afficher le JFileChooser if (resultatEnregistrer == JFileChooser.APPROVE_OPTION) { String monFichier= new String(filechoose.getSelectedFile().toString()); if(monFichier.endsWith(".txt") || monFichier.endsWith(".txt")) {;} else (monFichier = monFichier+ ".txt") { try { FileWriter lu = new FileWriter(monFichier); BufferedWriter out = new BufferedWriter(lu); out.write(textArea.getText()); // out.close(); } catch (IOException er) {;} } } } catch (IOException er) {;} }