fin création d'une grille vide

This commit is contained in:
Wilfried BRIGITTE 2024-04-15 12:09:11 +02:00
parent bb5488f3bb
commit 08e7104bcb
2 changed files with 20 additions and 13 deletions

View File

@ -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));

View File

@ -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;
}
});