Modification des boutons

This commit is contained in:
Lyanis SOUIDI 2023-04-28 17:45:35 +02:00
parent e428691761
commit 486e3288aa
Signed by: Lyanis SOUIDI
GPG Key ID: 251ADD56CFE6A854
3 changed files with 24 additions and 13 deletions

17
src/Button.java Normal file
View File

@ -0,0 +1,17 @@
import javax.swing.*;
import java.awt.*;
public class Button extends JButton {
public Button (String text) {
super(text);
setFont(new Font("Arial", Font.BOLD, 15));
setBackground(new Color(96, 175, 255));
}
public Button(String text, Dimension dimension) {
super(text);
setPreferredSize(dimension);
setFont(new Font("Arial", Font.BOLD, 20));
setBackground(new Color(96, 175, 255));
}
}

View File

@ -11,9 +11,9 @@ public class EditorController extends GridController {
private EditorView view; private EditorView view;
private enum Mode { DISABLED, WALL, THESEE, EXIT } private enum Mode { DISABLED, WALL, THESEE, EXIT }
private Mode editMode = Mode.DISABLED; private Mode editMode = Mode.DISABLED;
private JButton editTheseeButton = new JButton("Placer Joueur"); private Button editTheseeButton = new Button("Placer Joueur");
private JButton editExitButton = new JButton("Placer Sortie"); private Button editExitButton = new Button("Placer Sortie");
private JButton editWallButton = new JButton("Enlever/Ajouter Murs"); private Button editWallButton = new Button("Enlever/Ajouter Murs");
public EditorController(Editor model, EditorView view) { public EditorController(Editor model, EditorView view) {
super(model.getGrid(), view); super(model.getGrid(), view);

View File

@ -39,12 +39,9 @@ public class HomeView extends JPanel {
return texte; return texte;
} }
private static JButton choisirGrille(Window window) { private static Button choisirGrille(Window window) {
JPanel panel = new JPanel(); JPanel panel = new JPanel();
JButton choisirGrille = new JButton("Générer une grille"); Button choisirGrille = new Button("Générer une grille", new Dimension(250, 50));
choisirGrille.setPreferredSize(new Dimension(250, 50));
choisirGrille.setFont(new Font("Arial", Font.BOLD, 20));
choisirGrille.setBackground(new Color(96, 175, 255));
choisirGrille.addActionListener(e -> { choisirGrille.addActionListener(e -> {
String strTaille = JOptionPane.showInputDialog(panel, "Entrez la taille de la grille :", "Taille de la grille", JOptionPane.PLAIN_MESSAGE); String strTaille = JOptionPane.showInputDialog(panel, "Entrez la taille de la grille :", "Taille de la grille", JOptionPane.PLAIN_MESSAGE);
@ -96,12 +93,9 @@ public class HomeView extends JPanel {
return choisirGrille; return choisirGrille;
} }
private static JButton importerGrille(Window window) { private static Button importerGrille(Window window) {
JPanel panel = new JPanel(); JPanel panel = new JPanel();
JButton importerGrille = new JButton("Importer une grille"); Button importerGrille = new Button("Importer une grille", new Dimension(250, 50));
importerGrille.setPreferredSize(new Dimension(250, 50));
importerGrille.setFont(new Font("Arial", Font.BOLD, 20));
importerGrille.setBackground(new Color(96, 175, 255));
importerGrille.addActionListener(e -> { importerGrille.addActionListener(e -> {
JFileChooser fileChooser = new JFileChooser(); JFileChooser fileChooser = new JFileChooser();