From dfd9b1169e2678ab85ac6c78e339614144a8206a Mon Sep 17 00:00:00 2001 From: stiti Date: Tue, 30 Apr 2024 17:01:48 +0200 Subject: [PATCH] =?UTF-8?q?Am=C3=A9lioration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/GMCase.java | 2 ++ src/GMChecker.java | 2 -- src/GMCheckerListener.java | 28 ---------------------------- src/GMUserInterfaceView.java | 4 ---- src/GSCase.java | 14 +++++++++----- 5 files changed, 11 insertions(+), 39 deletions(-) delete mode 100644 src/GMCheckerListener.java diff --git a/src/GMCase.java b/src/GMCase.java index a0b2266..159969a 100755 --- a/src/GMCase.java +++ b/src/GMCase.java @@ -43,6 +43,8 @@ public class GMCase extends JPanel { actionButton.setContentAreaFilled(false); actionButton.setBorderPainted(false); actionButton.setPreferredSize(new Dimension(50, 50)); + Font buttonFont = actionButton.getFont(); + actionButton.setFont(new Font(buttonFont.getName(), Font.PLAIN, 60)); BorderLayout gestionnaire = new BorderLayout(); setLayout(gestionnaire); diff --git a/src/GMChecker.java b/src/GMChecker.java index 172ab01..5a7ef15 100755 --- a/src/GMChecker.java +++ b/src/GMChecker.java @@ -10,7 +10,6 @@ import javax.swing.*; public class GMChecker { private GMGrid grid; - private GMCheckerListener checkerListener; /** * Constructeur pour créer une instance de GMChecker. @@ -18,7 +17,6 @@ public class GMChecker { */ public GMChecker(GMGrid grid) { this.grid = grid; - this.checkerListener = new GMCheckerListener(this); } diff --git a/src/GMCheckerListener.java b/src/GMCheckerListener.java deleted file mode 100644 index 49ad11d..0000000 --- a/src/GMCheckerListener.java +++ /dev/null @@ -1,28 +0,0 @@ -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -/** - * La classe GMCheckerListener est utilisée pour gérer les événements liés à la vérification de la grille. - */ -public class GMCheckerListener implements ActionListener { - - private GMChecker gridMakerChecker; - - /** - * Constructeur de GMCheckerListener. - * @param gridMakerChecker L'instance de GMChecker à utiliser. - */ - public GMCheckerListener(GMChecker gridMakerChecker) { - this.gridMakerChecker = gridMakerChecker; - } - - /** - * Méthode invoquée lorsque le bouton "Vérifier" est cliqué. - * Lance la vérification de la grille. - * @param e L'événement d'action - */ - @Override - public void actionPerformed(ActionEvent e) { - gridMakerChecker.checkGridMessage(); - } -} diff --git a/src/GMUserInterfaceView.java b/src/GMUserInterfaceView.java index 1cfb51f..ef8a188 100755 --- a/src/GMUserInterfaceView.java +++ b/src/GMUserInterfaceView.java @@ -39,9 +39,6 @@ public class GMUserInterfaceView { JMenuItem nouveauItem = createMenuItem("Nouveau", new GMResetGrid(grid)); JMenuItem chargerItem = createMenuItem("Charger", new GMImport(window, grid)); JMenuItem sauvegarderItem = createMenuItem("Sauvegarder", new GMSaverActionListener(window, grid)); - GMChecker checker = new GMChecker(grid); // Créez une instance de GMChecker - GMCheckerListener checkerListener = new GMCheckerListener(checker); // Créez une instance de GMCheckerListener en passant GMChecker en argument - JMenuItem verifierItem = createMenuItem("Vérifier", checkerListener); JMenuItem aideGrilleItem = createMenuItem("Comment créer une grille", new GMHowToCreateController()); JMenuItem reglesSudokuItem = createMenuItem("Règles du Sudoku", new GMRules()); @@ -60,7 +57,6 @@ public class GMUserInterfaceView { menuFichier.add(nouveauItem); menuFichier.add(chargerItem); menuFichier.add(sauvegarderItem); - menuGrille.add(verifierItem); menuAide.add(aideGrilleItem); menuAide.add(reglesSudokuItem); diff --git a/src/GSCase.java b/src/GSCase.java index 15fd164..0601c6c 100755 --- a/src/GSCase.java +++ b/src/GSCase.java @@ -1,6 +1,7 @@ import java.awt.Color; import javax.swing.JPanel; import javax.swing.JLabel; +import java.awt.Font; /** * GSCase représente une case dans une grille de jeu. @@ -56,9 +57,12 @@ public class GSCase extends JPanel { * Initialise la case avec une valeur initiale. */ public void initializeCell() { + Font font = label.getFont(); + label.setFont(font.deriveFont(font.getSize() + 15f)); + label.setText(this.text); this.setBackground(this.isInitial ? Color.lightGray : Color.white); - layoutSetup(); + layoutSetup(); } /** @@ -115,18 +119,18 @@ public class GSCase extends JPanel { } else if (this.digitCount == 1 && value != this.primaryValue) { this.secondaryValue = value; this.digitCount++; - this.text = String.valueOf(this.primaryValue + ", " + this.secondaryValue); + this.text = String.valueOf(this.primaryValue + " " + this.secondaryValue); } else if (this.digitCount == 2 && value != this.primaryValue && value != this.secondaryValue) { this.tertiaryValue = value; this.digitCount++; - this.text = String.valueOf(this.primaryValue + ", " + this.secondaryValue + ", " + this.tertiaryValue); + this.text = String.valueOf(this.primaryValue + " " + this.secondaryValue + " " + this.tertiaryValue); } else if (this.digitCount == 3 && value != this.primaryValue && value != this.secondaryValue && value != this.tertiaryValue) { this.quaternaryValue = value; this.digitCount++; - this.text = String.valueOf(this.primaryValue + ", " + this.secondaryValue + ", " + this.tertiaryValue + ", " + this.quaternaryValue); + this.text = String.valueOf(this.primaryValue + " " + this.secondaryValue + " " + this.tertiaryValue + " " + this.quaternaryValue); } } - this.setBackground(Color.WHITE); + this.setBackground(Color.PINK); layoutSetup(); } else if (checkInputValue(value)){ this.setBackground(Color.RED);