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
| /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package productbpas;
import java.io.File;
import java.io.PrintWriter;
import java.io.FileWriter;
import java.io.IOException;
import javax.swing.JFileChooser;
/**
*
* @author himera
*/
public class EssaiChoixFichier {
public static void main(String[] arg) throws IOException {
JFileChooser dialogue = new JFileChooser(new File(".sysmli"));// choix de fichier d'extention .sysml
PrintWriter s;
File fichier; // fichier
if (dialogue.showOpenDialog(null)==
JFileChooser.APPROVE_OPTION) { //ouvrir une boite de dialogue et selection un fichier
fichier = dialogue.getSelectedFile();
s = new PrintWriter
(new FileWriter(fichier.getPath(), true)); //
s.println(arg[0]);
s.close();
}
}
} |
Partager