Lecteur
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+2
-1
@@ -4,7 +4,7 @@ import java.io.*;
|
||||
import javax.swing.filechooser.FileNameExtensionFilter;
|
||||
|
||||
public class Lecteur{
|
||||
public static void lecture(String name, int [][] g) {
|
||||
public static void lecture(File name, int [][] g) {
|
||||
|
||||
int valeur[] = new int[9];
|
||||
int valeur_en_fin[][]= new int[9][9];
|
||||
@@ -41,5 +41,6 @@ public class Lecteur{
|
||||
}
|
||||
valeur_actuelle=0;
|
||||
}
|
||||
System.out.print("Fichier enregistrer");
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+6
-6
@@ -45,17 +45,17 @@ public class MainCreation {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
selF.dispose();
|
||||
JFileChooser fichier = new JFileChooser();
|
||||
JFileChooser fileChooser = new JFileChooser();
|
||||
|
||||
FileNameExtensionFilter filter = new FileNameExtensionFilter("File grille","gri");
|
||||
fichier.setFileFilter(filter);
|
||||
fileChooser.setFileFilter(filter);
|
||||
|
||||
File workingDirectory = new File(System.getProperty("user.dir"));
|
||||
fichier.setCurrentDirectory(workingDirectory);
|
||||
fileChooser.setCurrentDirectory(workingDirectory);
|
||||
JPanel panneau = new JPanel();
|
||||
int valeur_de_retour = fichier.showOpenDialog(panneau);
|
||||
int valeur_de_retour = fileChooser.showOpenDialog(panneau);
|
||||
if(valeur_de_retour == JFileChooser.APPROVE_OPTION) {
|
||||
Lecteur.lecture(fichier.getSelectedFile().getName(), grille);
|
||||
Lecteur.lecture(fileChooser.getSelectedFile(), grille);
|
||||
fenetreModification(grille);
|
||||
}
|
||||
}
|
||||
@@ -80,7 +80,7 @@ public class MainCreation {
|
||||
JPanel panneau = new JPanel();
|
||||
int valeur_de_retour = fileChooser.showOpenDialog(panneau);
|
||||
if(valeur_de_retour == JFileChooser.APPROVE_OPTION) {
|
||||
Register.sauvegarde(fileChooser.getSelectedFile().getName(), grille);
|
||||
Register.sauvegarde(fileChooser.getSelectedFile(), grille);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Binary file not shown.
Binary file not shown.
+2
-1
@@ -4,7 +4,7 @@ import java.io.*;
|
||||
import javax.swing.filechooser.FileNameExtensionFilter;
|
||||
|
||||
public class Register{
|
||||
public static void sauvegarde(String name, int [][] g){
|
||||
public static void sauvegarde(File name, int [][] g){
|
||||
int val[] = new int[9];
|
||||
|
||||
int actuVal=0;
|
||||
@@ -33,5 +33,6 @@ public class Register{
|
||||
}catch(FileNotFoundException e){
|
||||
System.out.println("Fichier non trouvé");
|
||||
}
|
||||
System.out.print("Fichier enregistrer");
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user