diff --git a/Sudoku/grille$1.class b/Sudoku/grille$1.class new file mode 100644 index 0000000..a7e32d6 Binary files /dev/null and b/Sudoku/grille$1.class differ diff --git a/Sudoku/grille$2.class b/Sudoku/grille$2.class new file mode 100644 index 0000000..dd9fac8 Binary files /dev/null and b/Sudoku/grille$2.class differ diff --git a/Sudoku/grille.class b/Sudoku/grille.class new file mode 100644 index 0000000..bc42ff7 Binary files /dev/null and b/Sudoku/grille.class differ diff --git a/Sudoku/grille.java b/Sudoku/grille.java index 3fd78cd..68796b3 100644 --- a/Sudoku/grille.java +++ b/Sudoku/grille.java @@ -54,7 +54,6 @@ public class grille extends JComponent{ } else { - /*affichage de la grille*/ JTextField[][] case_modifiable = null; JLabel[][] case_depart = null; case_depart = new JLabel[9][9]; @@ -118,13 +117,21 @@ public class grille extends JComponent{ /*System.out.println(grid[0][0].getText());*/ - if (verifier != null) { // Vérification pour s'assurer que verifier a été initialisé + if (verifier != null) { /* Vérification pour s'assurer que verifier a été initialisé */ verifier.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent verifier) { } }); } + + if (exporter != null) { /* Vérification pour s'assurer que exporter a été initialisé */ + exporter.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent exporter) { + ExporterGrille(ConvertirGrilleActuelle(place_grille)); + } + }); + } } @@ -166,6 +173,31 @@ public class grille extends JComponent{ } public static void ExporterGrille(int[][] grille){ + for (int i = 0; i < grille.length; i++) { + for (int j = 0; j < grille[i].length; j++) { + System.out.print(grille[i][j] + " "); + } + System.out.println(); + } + } + public static int[][] ConvertirGrilleActuelle(JPanel place_grille){ + int[][] grilleActuelle = new int[9][9]; + + for (Component comp : place_grille.getComponents()) { + if (comp instanceof JTextField) { + JTextField textField = (JTextField) comp; + String text = textField.getText().trim(); + int value = text.isEmpty() ? 0 : Integer.parseInt(text); + grilleActuelle[place_grille.getComponentZOrder(comp) / 9][place_grille.getComponentZOrder(comp) % 9] = value; + } else if (comp instanceof JLabel) { + JLabel label = (JLabel) comp; + String text = label.getText().trim(); + int value = Integer.parseInt(text); + grilleActuelle[place_grille.getComponentZOrder(comp) / 9][place_grille.getComponentZOrder(comp) % 9] = value; + } + } + + return grilleActuelle; } } \ No newline at end of file diff --git a/Sudoku/mainProgramme1.class b/Sudoku/mainProgramme1.class new file mode 100644 index 0000000..c5b6748 Binary files /dev/null and b/Sudoku/mainProgramme1.class differ diff --git a/Sudoku/mainProgramme2.class b/Sudoku/mainProgramme2.class new file mode 100644 index 0000000..4cd2638 Binary files /dev/null and b/Sudoku/mainProgramme2.class differ diff --git a/Sudoku/menuProgramme1$1.class b/Sudoku/menuProgramme1$1.class new file mode 100644 index 0000000..c563e1e Binary files /dev/null and b/Sudoku/menuProgramme1$1.class differ diff --git a/Sudoku/menuProgramme1$2.class b/Sudoku/menuProgramme1$2.class new file mode 100644 index 0000000..c1c25e9 Binary files /dev/null and b/Sudoku/menuProgramme1$2.class differ diff --git a/Sudoku/menuProgramme1$3.class b/Sudoku/menuProgramme1$3.class new file mode 100644 index 0000000..06cf3dc Binary files /dev/null and b/Sudoku/menuProgramme1$3.class differ diff --git a/Sudoku/menuProgramme1$4.class b/Sudoku/menuProgramme1$4.class new file mode 100644 index 0000000..6248b3f Binary files /dev/null and b/Sudoku/menuProgramme1$4.class differ diff --git a/Sudoku/menuProgramme1.class b/Sudoku/menuProgramme1.class new file mode 100644 index 0000000..41e714d Binary files /dev/null and b/Sudoku/menuProgramme1.class differ diff --git a/Sudoku/menuProgramme2$1.class b/Sudoku/menuProgramme2$1.class new file mode 100644 index 0000000..62d088d Binary files /dev/null and b/Sudoku/menuProgramme2$1.class differ diff --git a/Sudoku/menuProgramme2$2.class b/Sudoku/menuProgramme2$2.class new file mode 100644 index 0000000..1aee62c Binary files /dev/null and b/Sudoku/menuProgramme2$2.class differ diff --git a/Sudoku/menuProgramme2$3.class b/Sudoku/menuProgramme2$3.class new file mode 100644 index 0000000..23581ab Binary files /dev/null and b/Sudoku/menuProgramme2$3.class differ diff --git a/Sudoku/menuProgramme2$4.class b/Sudoku/menuProgramme2$4.class new file mode 100644 index 0000000..fad8aa5 Binary files /dev/null and b/Sudoku/menuProgramme2$4.class differ diff --git a/Sudoku/menuProgramme2$5.class b/Sudoku/menuProgramme2$5.class new file mode 100644 index 0000000..3ea1c4e Binary files /dev/null and b/Sudoku/menuProgramme2$5.class differ diff --git a/Sudoku/menuProgramme2.class b/Sudoku/menuProgramme2.class new file mode 100644 index 0000000..73f1302 Binary files /dev/null and b/Sudoku/menuProgramme2.class differ diff --git a/Sudoku/resolveurGrille.class b/Sudoku/resolveurGrille.class new file mode 100644 index 0000000..e0b145a Binary files /dev/null and b/Sudoku/resolveurGrille.class differ