diff --git a/AutomatiqueActionListener.class b/AutomatiqueActionListener.class index c66d6db..71d5119 100644 Binary files a/AutomatiqueActionListener.class and b/AutomatiqueActionListener.class differ diff --git a/CaseMouseListener.class b/CaseMouseListener.class index fd52052..cfb8716 100644 Binary files a/CaseMouseListener.class and b/CaseMouseListener.class differ diff --git a/FenetreChoix.class b/FenetreChoix.class index dacb400..f204a25 100644 Binary files a/FenetreChoix.class and b/FenetreChoix.class differ diff --git a/FenetreModif$1.class b/FenetreModif$1.class new file mode 100644 index 0000000..84eaabf Binary files /dev/null and b/FenetreModif$1.class differ diff --git a/FenetreModif.class b/FenetreModif.class new file mode 100644 index 0000000..5e1dabe Binary files /dev/null and b/FenetreModif.class differ diff --git a/FenetreModif.java b/FenetreModif.java new file mode 100644 index 0000000..7918950 --- /dev/null +++ b/FenetreModif.java @@ -0,0 +1,46 @@ +import javax.swing.*; +import java.awt.*; +import java.awt.event.*; +import java.io.*; +import java.io.File; +import java.io.PrintWriter; +import java.io.FileWriter; +import java.io.IOException; +import javax.swing.JFileChooser; +import javax.swing.filechooser.FileNameExtensionFilter; + +public class FenetreModif{ + public static void fenetreModification(int[][] grille) { + JFrame frame = new JFrame("Sudoku"); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + SaisieGrille saisieGrille = new SaisieGrille(grille); // Utilisation de la classe SaisieGrille pour permettre la saisie des valeurs + JButton register = new JButton("Enregistrer"); + register.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e){ + JFileChooser fileChooser = new JFileChooser(); + + FileNameExtensionFilter filter = new FileNameExtensionFilter("File grille","gri"); + fileChooser.setFileFilter(filter); + + File workingDirectory = new File(System.getProperty("user.dir")); + fileChooser.setCurrentDirectory(workingDirectory); + JPanel panneau = new JPanel(); + int valeur_de_retour = fileChooser.showOpenDialog(panneau); + if(valeur_de_retour == JFileChooser.APPROVE_OPTION) { + Register.sauvegarde(fileChooser.getSelectedFile(), grille); + } + } + }); + + frame.add(register, BorderLayout.SOUTH); // Ajouter le bouton "Enregistrer" + + frame.add(saisieGrille, BorderLayout.CENTER); // Ajouter la grille à la fenêtre + + frame.pack(); + frame.setLocationRelativeTo(null); // Centrer la fenêtre sur l'écran + frame.setVisible(true); + + System.out.println("La fenêtre de création a été affichée."); + } +} \ No newline at end of file diff --git a/FenetrePrincipale.class b/FenetrePrincipale.class index 36ba0cc..c76e9e8 100644 Binary files a/FenetrePrincipale.class and b/FenetrePrincipale.class differ diff --git a/GenerateurSudoku.class b/GenerateurSudoku.class index 2340c60..baf4bc2 100644 Binary files a/GenerateurSudoku.class and b/GenerateurSudoku.class differ diff --git a/GrilleExisteActionListener.class b/GrilleExisteActionListener.class new file mode 100644 index 0000000..f9e2114 Binary files /dev/null and b/GrilleExisteActionListener.class differ diff --git a/GrilleExisteActionListener.java b/GrilleExisteActionListener.java new file mode 100644 index 0000000..90c7491 --- /dev/null +++ b/GrilleExisteActionListener.java @@ -0,0 +1,38 @@ +import javax.swing.*; +import java.awt.*; +import java.awt.event.*; +import java.io.*; +import java.io.File; +import java.io.PrintWriter; +import java.io.FileWriter; +import java.io.IOException; +import javax.swing.JFileChooser; +import javax.swing.filechooser.FileNameExtensionFilter; + +public class GrilleExisteActionListener implements ActionListener{ + private JFrame choixFrame; + + public GrilleExisteActionListener(JFrame choixFrame) { + this.choixFrame = choixFrame; + } + + @Override + + public void actionPerformed(ActionEvent e) { + choixFrame.dispose(); + int [][] grille = new int [9][9]; + JFileChooser fileChooser = new JFileChooser(); + + FileNameExtensionFilter filter = new FileNameExtensionFilter("File grille","gri"); + fileChooser.setFileFilter(filter); + + File workingDirectory = new File(System.getProperty("user.dir")); + fileChooser.setCurrentDirectory(workingDirectory); + JPanel panneau = new JPanel(); + int valeur_de_retour = fileChooser.showOpenDialog(panneau); + if(valeur_de_retour == JFileChooser.APPROVE_OPTION) { + Lecteur.lecture(fileChooser.getSelectedFile(), grille); + FenetreModif.fenetreModification(grille); + } + } +} \ No newline at end of file diff --git a/GrillePainter.class b/GrillePainter.class index f389392..577e558 100644 Binary files a/GrillePainter.class and b/GrillePainter.class differ diff --git a/GrilleSudokuDessin.class b/GrilleSudokuDessin.class index 2554d2a..28cb06b 100644 Binary files a/GrilleSudokuDessin.class and b/GrilleSudokuDessin.class differ diff --git a/GrilleVideActionListener.class b/GrilleVideActionListener.class new file mode 100644 index 0000000..5132c2d Binary files /dev/null and b/GrilleVideActionListener.class differ diff --git a/GrilleVideActionListener.java b/GrilleVideActionListener.java new file mode 100644 index 0000000..35aed73 --- /dev/null +++ b/GrilleVideActionListener.java @@ -0,0 +1,28 @@ +import javax.swing.*; +import java.awt.*; +import java.awt.event.*; +import java.io.*; +import java.io.File; +import java.io.PrintWriter; +import java.io.FileWriter; +import java.io.IOException; +import javax.swing.JFileChooser; +import javax.swing.filechooser.FileNameExtensionFilter; + +public class GrilleVideActionListener implements ActionListener{ + private JFrame choixFrame; + + public GrilleVideActionListener(JFrame choixFrame) { + this.choixFrame = choixFrame; + } + + @Override + + public void actionPerformed(ActionEvent e) { + int [][] grille = new int [9][9]; + choixFrame.dispose(); + Grilles.grilleVide(grille); + FenetreModif.fenetreModification(grille); + } + +} \ No newline at end of file diff --git a/Grilles.class b/Grilles.class index 005a27b..18560e4 100644 Binary files a/Grilles.class and b/Grilles.class differ diff --git a/Grilles/GrillesTest.gri b/Grilles/GrillesTest.gri index 1f76f3f..6ebe5a7 100644 Binary files a/Grilles/GrillesTest.gri and b/Grilles/GrillesTest.gri differ diff --git a/Lecteur.class b/Lecteur.class index 5bbcc2a..8e08d2c 100644 Binary files a/Lecteur.class and b/Lecteur.class differ diff --git a/Lecteur.java b/Lecteur.java index d7d76b1..619a279 100644 --- a/Lecteur.java +++ b/Lecteur.java @@ -41,6 +41,5 @@ public class Lecteur{ } valeur_actuelle=0; } - System.out.print("Fichier enregistrer"); } } \ No newline at end of file diff --git a/Main.class b/Main.class index 9a47b06..edb9063 100644 Binary files a/Main.class and b/Main.class differ diff --git a/MainCreation$1.class b/MainCreation$1.class index 85a5597..47b9e23 100644 Binary files a/MainCreation$1.class and b/MainCreation$1.class differ diff --git a/MainCreation$2.class b/MainCreation$2.class index fbea975..b5581ec 100644 Binary files a/MainCreation$2.class and b/MainCreation$2.class differ diff --git a/MainCreation$3.class b/MainCreation$3.class deleted file mode 100644 index 7ca7a6c..0000000 Binary files a/MainCreation$3.class and /dev/null differ diff --git a/MainCreation.class b/MainCreation.class index 59ef04d..94b2805 100644 Binary files a/MainCreation.class and b/MainCreation.class differ diff --git a/MainCreation.java b/MainCreation.java index c5c51e6..7867bb3 100644 --- a/MainCreation.java +++ b/MainCreation.java @@ -11,7 +11,6 @@ import javax.swing.filechooser.FileNameExtensionFilter; public class MainCreation { public static void main(String[] args) { - int [][] grille = new int [9][9]; //Création de la fenetre de selection + choix du dossier JFrame selF = new JFrame("Choix de résolution du Sudoku"); selF.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); @@ -33,15 +32,16 @@ public class MainCreation { selF.add(boutonsSelect, BorderLayout.CENTER); selF.setVisible(true); //Action des bouton - grilleVide.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { + grilleVide.addActionListener(new GrilleVideActionListener(selF)); + grilleExiste.addActionListener(new GrilleExisteActionListener(selF)); + /*grilleVide.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { selF.dispose(); Grilles.grilleVide(grille); - fenetreModification(grille); + FenetreModif.fenetreModification(grille); } - }); - grilleExiste.addActionListener(new ActionListener() { + });*/ + /* grilleExiste.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { selF.dispose(); @@ -56,43 +56,9 @@ public class MainCreation { int valeur_de_retour = fileChooser.showOpenDialog(panneau); if(valeur_de_retour == JFileChooser.APPROVE_OPTION) { Lecteur.lecture(fileChooser.getSelectedFile(), grille); - fenetreModification(grille); + FenetreModif.fenetreModification(grille); } } - }); - } - - private static void fenetreModification(int[][] grille) { - JFrame frame = new JFrame("Sudoku"); - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - SaisieGrille saisieGrille = new SaisieGrille(grille); // Utilisation de la classe SaisieGrille pour permettre la saisie des valeurs - JButton register = new JButton("Enregistrer"); - register.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e){ - JFileChooser fileChooser = new JFileChooser(); - - FileNameExtensionFilter filter = new FileNameExtensionFilter("File grille","gri"); - fileChooser.setFileFilter(filter); - - File workingDirectory = new File(System.getProperty("user.dir")); - fileChooser.setCurrentDirectory(workingDirectory); - JPanel panneau = new JPanel(); - int valeur_de_retour = fileChooser.showOpenDialog(panneau); - if(valeur_de_retour == JFileChooser.APPROVE_OPTION) { - Register.sauvegarde(fileChooser.getSelectedFile(), grille); - } - } - }); - - frame.add(register, BorderLayout.SOUTH); // Ajouter le bouton "Enregistrer" - - frame.add(saisieGrille, BorderLayout.CENTER); // Ajouter la grille à la fenêtre - - frame.pack(); - frame.setLocationRelativeTo(null); // Centrer la fenêtre sur l'écran - frame.setVisible(true); - - System.out.println("La fenêtre de création a été affichée."); + });*/ } } diff --git a/ManuelActionListener.class b/ManuelActionListener.class index 92d4880..05ad053 100644 Binary files a/ManuelActionListener.class and b/ManuelActionListener.class differ diff --git a/OuvertureFichier.class b/OuvertureFichier.class index 932c978..039a049 100644 Binary files a/OuvertureFichier.class and b/OuvertureFichier.class differ diff --git a/Register.class b/Register.class index 62153d9..3d22e40 100644 Binary files a/Register.class and b/Register.class differ diff --git a/Reinitialiser.class b/Reinitialiser.class index 24351e8..7a9179d 100644 Binary files a/Reinitialiser.class and b/Reinitialiser.class differ diff --git a/ReinitialiserActionListener.class b/ReinitialiserActionListener.class index 8378a28..76190d5 100644 Binary files a/ReinitialiserActionListener.class and b/ReinitialiserActionListener.class differ diff --git a/Resolveur.class b/Resolveur.class index 7d4924b..c039556 100644 Binary files a/Resolveur.class and b/Resolveur.class differ diff --git a/SaisieGrille.class b/SaisieGrille.class index 285c6e3..ab56530 100644 Binary files a/SaisieGrille.class and b/SaisieGrille.class differ diff --git a/SudokuGenerator.class b/SudokuGenerator.class index 0511a21..c8d4474 100644 Binary files a/SudokuGenerator.class and b/SudokuGenerator.class differ