diff --git a/Sudoku/grille.java b/Sudoku/grille.java index 06ec7e5..5c71d78 100644 --- a/Sudoku/grille.java +++ b/Sudoku/grille.java @@ -25,10 +25,10 @@ public class grille extends JComponent{ case_editable = new JTextField[9][9]; for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { - if (grid_values[i][j] == 0){ + if (grille[i][j] == 0){ case_editable[i][j] = new JTextField("", 1); }else{ - case_editable[i][j] = new JTextField(String.valueOf(grid_values[i][j]), 1); + case_editable[i][j] = new JTextField(String.valueOf(grille[i][j]), 1); } case_editable[i][j].setBorder(new LineBorder(Color.BLACK, 5)); case_editable[i][j].setFont(new Font("Arial", Font.PLAIN, 30)); diff --git a/Sudoku/menu.java b/Sudoku/menu.java index ce4e71d..c9cb7ca 100644 --- a/Sudoku/menu.java +++ b/Sudoku/menu.java @@ -84,18 +84,25 @@ public class menu { }); editer.addActionListener(new ActionListener(){ - public void actionPerformed(ActionEvent e4){ - if (cheminFichier != null){ - int[][] grille_vide = new int[9][9]; - Arrays.fill(grille_vide, 0); - fenetre.dispose(); - grille.AfficherGrille(grille_vide, true); - }else{ - fenetre.dispose(); - grille.AfficherGrille(grille.ChargerGrille(cheminFichier), true); + public void actionPerformed(ActionEvent e4){ + if (cheminFichier == null){ + int[][] grille_vide = null; + grille_vide = new int[9][9]; + + for (int i = 0; i < 9; i++) { + for (int j = 0; j < 9 ; j++ ) { + grille_vide[i][j] = 0; } } - }); + + fenetre.dispose(); + grille.AfficherGrille(grille_vide, true); + }else{ + fenetre.dispose(); + grille.AfficherGrille(grille.ChargerGrille(cheminFichier), true); + } + } + }); lancer.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e2) { @@ -121,7 +128,7 @@ public class menu { manuel.addActionListener(new ActionListener() { @Override - public void actionPerformed(ActionEvent e) { + public void actionPerformed(ActionEvent e1) { ResolutionManuel = true; } });