diff --git a/Enter.class b/Enter.class index 6eb710e..ac23308 100644 Binary files a/Enter.class and b/Enter.class differ diff --git a/Enter.java b/Enter.java index 2e880d1..401795d 100644 --- a/Enter.java +++ b/Enter.java @@ -50,19 +50,36 @@ public class Enter extends JPanel { } @Override - protected void paintComponent(Graphics g) { - super.paintComponent(g); +protected void paintComponent(Graphics g) { + super.paintComponent(g); - // Dessiner les cases de la grille - for (int i = 0; i < GRID_SIZE * REGION_SIZE; i++) { - for (int j = 0; j < GRID_SIZE * REGION_SIZE; j++) { - g.setColor(Color.BLACK); - g.drawRect(j * CELL_SIZE, i * CELL_SIZE, CELL_SIZE, CELL_SIZE); - int value = grid[i][j]; - if (value != 0) { - g.drawString(String.valueOf(value), j * CELL_SIZE + CELL_SIZE / 2, i * CELL_SIZE + CELL_SIZE / 2); - } + // Dessiner les contours de la grille (en gras) + Graphics2D g2d = (Graphics2D) g; + Stroke oldStroke = g2d.getStroke(); // Sauvegarder le style de ligne précédent + g2d.setStroke(new BasicStroke(4)); // Épaisseur de ligne de 4 pixels + + for (int i = 0; i <= GRID_SIZE * REGION_SIZE; i++) { + if (i % REGION_SIZE == 0) { + g2d.drawLine(0, i * CELL_SIZE, GRID_SIZE * REGION_SIZE * CELL_SIZE, i * CELL_SIZE); + g2d.drawLine(i * CELL_SIZE, 0, i * CELL_SIZE, GRID_SIZE * REGION_SIZE * CELL_SIZE); + } + } + + // Rétablir le style de ligne précédent + g2d.setStroke(oldStroke); + + // Dessiner les cases de la grille + for (int i = 0; i < GRID_SIZE * REGION_SIZE; i++) { + for (int j = 0; j < GRID_SIZE * REGION_SIZE; j++) { + g.setColor(Color.BLACK); + g.drawRect(j * CELL_SIZE, i * CELL_SIZE, CELL_SIZE, CELL_SIZE); + int value = grid[i][j]; + if (value != 0) { + g.drawString(String.valueOf(value), j * CELL_SIZE + CELL_SIZE / 2, i * CELL_SIZE + CELL_SIZE / 2); } } } } + + +} diff --git a/Main.class b/Main.class index 42256b8..2a14126 100644 Binary files a/Main.class and b/Main.class differ diff --git a/Main.java b/Main.java index 197bfee..faffd2e 100644 --- a/Main.java +++ b/Main.java @@ -1,4 +1,6 @@ import javax.swing.*; +import java.awt.BorderLayout; + public class Main { public static void main(String[] args) { @@ -10,7 +12,18 @@ public class Main { JFrame frame = new JFrame("Sudoku"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Enter enterPanel = new Enter(grid); // Utilisation de la classe Enter pour permettre la saisie des valeurs - frame.add(enterPanel); + + // Ajout de deux boutons + JButton solveButton = new JButton("Solve"); + JButton resetButton = new JButton("Reset"); + JPanel buttonPanel = new JPanel(); + buttonPanel.add(solveButton); + buttonPanel.add(resetButton); + + // Ajout des composants au frame + frame.add(enterPanel, BorderLayout.CENTER); + frame.add(buttonPanel, BorderLayout.SOUTH); + frame.pack(); frame.setLocationRelativeTo(null); // Centrer la fenêtre sur l'écran frame.setVisible(true); diff --git a/SudokuDraw.class b/SudokuDraw.class index 76be348..bff4ac3 100644 Binary files a/SudokuDraw.class and b/SudokuDraw.class differ diff --git a/SudokuDraw.java b/SudokuDraw.java index 1e60d57..d6216e3 100644 --- a/SudokuDraw.java +++ b/SudokuDraw.java @@ -15,7 +15,22 @@ public class SudokuDraw extends JPanel { @Override protected void paintComponent(Graphics g) { - super.paintComponent(g); + super.paintComponent(g); + + Graphics2D g2d = (Graphics2D) g; + // Définir l'épaisseur de la ligne + g2d.setStroke(new BasicStroke(20)); // Épaisseur de ligne de 4 pixels + + // Dessiner les lignes de la grille (en gras pour les contours) + for (int i = 0; i <= GRID_SIZE * REGION_SIZE; i++) { + if (i % REGION_SIZE == 0) { + g2d.drawRect(0, i * CELL_SIZE - 2, GRID_SIZE * REGION_SIZE * CELL_SIZE, 4); + g2d.drawRect(i * CELL_SIZE - 2, 0, 4, GRID_SIZE * REGION_SIZE * CELL_SIZE); + } else { + g2d.drawRect(0, i * CELL_SIZE - 1, GRID_SIZE * REGION_SIZE * CELL_SIZE, 2); + g2d.drawRect(i * CELL_SIZE - 1, 0, 2, GRID_SIZE * REGION_SIZE * CELL_SIZE); + } + } // Dessiner les valeurs de la grille g.setColor(Color.BLACK);