This commit is contained in:
raban 2024-05-02 12:12:32 +02:00
parent 022ac4299c
commit 0d812b9b4c
23 changed files with 10 additions and 8 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -4,7 +4,7 @@ import java.io.*;
import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.filechooser.FileNameExtensionFilter;
public class Lecteur{ 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[] = new int[9];
int valeur_en_fin[][]= new int[9][9]; int valeur_en_fin[][]= new int[9][9];
@ -41,5 +41,6 @@ public class Lecteur{
} }
valeur_actuelle=0; valeur_actuelle=0;
} }
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.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -45,17 +45,17 @@ public class MainCreation {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
selF.dispose(); selF.dispose();
JFileChooser fichier = new JFileChooser(); JFileChooser fileChooser = new JFileChooser();
FileNameExtensionFilter filter = new FileNameExtensionFilter("File grille","gri"); FileNameExtensionFilter filter = new FileNameExtensionFilter("File grille","gri");
fichier.setFileFilter(filter); fileChooser.setFileFilter(filter);
File workingDirectory = new File(System.getProperty("user.dir")); File workingDirectory = new File(System.getProperty("user.dir"));
fichier.setCurrentDirectory(workingDirectory); fileChooser.setCurrentDirectory(workingDirectory);
JPanel panneau = new JPanel(); 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) { if(valeur_de_retour == JFileChooser.APPROVE_OPTION) {
Lecteur.lecture(fichier.getSelectedFile().getName(), grille); Lecteur.lecture(fileChooser.getSelectedFile(), grille);
fenetreModification(grille); fenetreModification(grille);
} }
} }
@ -80,7 +80,7 @@ public class MainCreation {
JPanel panneau = new JPanel(); JPanel panneau = new JPanel();
int valeur_de_retour = fileChooser.showOpenDialog(panneau); int valeur_de_retour = fileChooser.showOpenDialog(panneau);
if(valeur_de_retour == JFileChooser.APPROVE_OPTION) { 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.

View File

@ -4,7 +4,7 @@ import java.io.*;
import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.filechooser.FileNameExtensionFilter;
public class Register{ 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 val[] = new int[9];
int actuVal=0; int actuVal=0;
@ -33,5 +33,6 @@ public class Register{
}catch(FileNotFoundException e){ }catch(FileNotFoundException e){
System.out.println("Fichier non trouvé"); 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.