From 0cc20679223186faf543a42f54cd68479b9e19ec Mon Sep 17 00:00:00 2001 From: stiti Date: Mon, 29 Apr 2024 14:34:45 +0200 Subject: [PATCH] Correction des bugs de verions entre Windows, Linux et macOS --- Makefile | 4 ++-- src/GridMaker/Button.java | 11 +++++++++++ src/GridMaker/HomeView.java | 2 +- src/GridSolver/Button.java | 11 +++++++++++ src/GridSolver/GSMenu.java | 6 +++--- src/GridSolver/HomeView.java | 2 +- 6 files changed, 29 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 9d20c79..33dbd90 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ JCFLAGS := -encoding UTF-8 -implicit:none JVM := java JVMFLAGS := -SRCDIR := ./src/GridMaker +SRCDIR := ./src/GridSolver OUTDIR := ./out DOCDIR := ./doc SRC := $(wildcard $(SRCDIR)/*.java) @@ -42,4 +42,4 @@ doc : .PHONY : run clean doc -### FIN ### +### FIN ### \ No newline at end of file diff --git a/src/GridMaker/Button.java b/src/GridMaker/Button.java index d17c996..88ba711 100644 --- a/src/GridMaker/Button.java +++ b/src/GridMaker/Button.java @@ -19,6 +19,17 @@ public class Button extends JButton { setBackground(new Color(96, 175, 255)); } + /** + * Constructor + * @param text The text of the button + * @param color The background color of the button + */ + public Button (String text,Color color) { + super(text); + setFont(new Font("Arial", Font.BOLD, 15)); + setBackground(color); + } + /** * Constructor * @param text The text of the button diff --git a/src/GridMaker/HomeView.java b/src/GridMaker/HomeView.java index e932d52..7e317d8 100644 --- a/src/GridMaker/HomeView.java +++ b/src/GridMaker/HomeView.java @@ -72,7 +72,7 @@ public class HomeView extends JPanel { buttonPanel.setBackground(BACKGROUND_COLOR); HomeButtonClickListener listenerButton = new HomeButtonClickListener(window); for (String text : BUTTON_TEXTS) { - Button button = new Button(text, BUTTON_SIZE, BUTTON_FONT, BACKGROUND_COLOR); + Button button = new Button(text, BUTTON_SIZE, BUTTON_FONT, Color.white); button.addActionListener(listenerButton); buttonPanel.add(button); } diff --git a/src/GridSolver/Button.java b/src/GridSolver/Button.java index d17c996..32ad054 100644 --- a/src/GridSolver/Button.java +++ b/src/GridSolver/Button.java @@ -18,6 +18,17 @@ public class Button extends JButton { setFont(new Font("Arial", Font.BOLD, 15)); setBackground(new Color(96, 175, 255)); } + + /** + * Constructor + * @param text The text of the button + * @param color The background color of the button + */ + public Button (String text,Color color) { + super(text); + setFont(new Font("Arial", Font.BOLD, 15)); + setBackground(color); + } /** * Constructor diff --git a/src/GridSolver/GSMenu.java b/src/GridSolver/GSMenu.java index 6216c63..6f5fe59 100755 --- a/src/GridSolver/GSMenu.java +++ b/src/GridSolver/GSMenu.java @@ -43,10 +43,10 @@ public class GSMenu { this.buttonPanel.setBackground(new Color(54, 91, 109)); // Création des boutons - this.importerButton = new Button("Charger une grille"); - this.jouerButton = new Button("Jouer"); + this.importerButton = new Button("Charger une grille",Color.white); + this.jouerButton = new Button("Jouer",Color.white); this.jouerButton.setEnabled(false); // Le bouton "Jouer" est désactivé par défaut - this.autoSolveButton = new Button("Résolution automatique"); + this.autoSolveButton = new Button("Résolution automatique",Color.white); this.autoSolveButton.setEnabled(false); // Le bouton "Résolution automatique" est désactivé par défaut // Ajout des boutons au panneau de boutons diff --git a/src/GridSolver/HomeView.java b/src/GridSolver/HomeView.java index eab4167..d0f2528 100644 --- a/src/GridSolver/HomeView.java +++ b/src/GridSolver/HomeView.java @@ -72,7 +72,7 @@ public class HomeView extends JPanel { buttonPanel.setBackground(BACKGROUND_COLOR); HomeButtonClickListener listenerButton = new HomeButtonClickListener(window); for (String text : BUTTON_TEXTS) { - Button button = new Button(text, BUTTON_SIZE, BUTTON_FONT, BACKGROUND_COLOR); + Button button = new Button(text, BUTTON_SIZE, BUTTON_FONT, Color.white); button.addActionListener(listenerButton); buttonPanel.add(button); }