From 58548c4ef8735ffdae628c5950f48138fb0def26 Mon Sep 17 00:00:00 2001 From: dagorne Date: Mon, 17 Oct 2022 13:42:19 +0200 Subject: [PATCH] MAJ P4 --- projetAgile/Makefile | 3 ++ .../projetAgile/Utils/Constants.java | 4 +-- .../projetAgile/View/Puissance4Panel.java | 34 +++++++++++++++++-- 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/projetAgile/Makefile b/projetAgile/Makefile index 7ced9be..550fa7e 100644 --- a/projetAgile/Makefile +++ b/projetAgile/Makefile @@ -88,5 +88,8 @@ build/$(PACKAGE_PATH)/View/TestGrille.class : src/$(PACKAGE_PATH)/View/TestGril testGrille : Controller Model View Utils Events java -cp build $(PACKAGE).View.TestGrille +puissance4 : Controller Model View Utils Events + java -cp build $(PACKAGE).View.Puissance4Panel + clear : rm -rf build/* diff --git a/projetAgile/src/fr/iutfbleau/projetAgile/Utils/Constants.java b/projetAgile/src/fr/iutfbleau/projetAgile/Utils/Constants.java index a8be309..cc7a8e6 100644 --- a/projetAgile/src/fr/iutfbleau/projetAgile/Utils/Constants.java +++ b/projetAgile/src/fr/iutfbleau/projetAgile/Utils/Constants.java @@ -8,8 +8,8 @@ public class Constants { PLAYING, STOP, DRAW; } - public final static Color PLAYER_ONE_COLOR = Color.RED; - public final static Color PLAYER_TWO_COLOR = Color.YELLOW; + public final static Color PLAYER_ONE_COLOR = new Color(252,21,21); + public final static Color PLAYER_TWO_COLOR = new Color(241,205,15); public final static Color EMPTY_COLOR = new Color(42,42,42); public final static int EMPTY_PLAYER = -1; public final static int PLAYER_ONE = 0; diff --git a/projetAgile/src/fr/iutfbleau/projetAgile/View/Puissance4Panel.java b/projetAgile/src/fr/iutfbleau/projetAgile/View/Puissance4Panel.java index 644f6fd..b67ee3e 100644 --- a/projetAgile/src/fr/iutfbleau/projetAgile/View/Puissance4Panel.java +++ b/projetAgile/src/fr/iutfbleau/projetAgile/View/Puissance4Panel.java @@ -2,6 +2,8 @@ package fr.iutfbleau.projetAgile.View; import javax.swing.*; import java.awt.*; +import fr.iutfbleau.projetAgile.Controller.GrilleMouseListener; +import fr.iutfbleau.projetAgile.Model.GrilleModel; public class Puissance4Panel extends JPanel{ @@ -14,8 +16,12 @@ public class Puissance4Panel extends JPanel{ super(); this.reset = new JButton("recommencer"); this.menu = new JButton("Accueil"); - this.label = new JLabel("??"); + this.label = new JLabel("TOUR DU JOUEUR 1"); this.grille = new Grille(); + + GrilleModel gm = new GrilleModel(); + GrilleMouseListener listener = new GrilleMouseListener(this.grille, gm); + this.init(); //this.grille.requestFocusInWindow(); } @@ -24,6 +30,7 @@ public class Puissance4Panel extends JPanel{ GridBagLayout gbl = new GridBagLayout(); this.setLayout(gbl); GridBagConstraints gbc = new GridBagConstraints(); + this.setBackground(new Color(31,31,31)); gbc.gridx = 0; gbc.gridy = 0; @@ -37,6 +44,10 @@ public class Puissance4Panel extends JPanel{ this.add(this.menu, gbc); + + JLabel titre = new JLabel("PUISSANCE 4"); + titre.setForeground(Color.WHITE); + gbc.gridx = 1; gbc.gridy = 0; gbc.fill = GridBagConstraints.NONE; @@ -47,7 +58,7 @@ public class Puissance4Panel extends JPanel{ gbc.weighty = 0; gbc.insets = new Insets(0, 0, 0, 0); - this.add(new JLabel("Puissance 4"), gbc); + this.add(titre, gbc); gbc.gridx = 1; gbc.gridy = 1; @@ -74,10 +85,29 @@ public class Puissance4Panel extends JPanel{ gbc.weighty = 0; gbc.insets = new Insets(0, 0, 0, 0); + panneauBas.setOpaque(false); + label.setForeground(Color.WHITE); this.add(panneauBas, gbc); + + reset.setBackground(new Color(255,64,64)); + reset.setForeground(Color.WHITE); + reset.setBorder(BorderFactory.createEmptyBorder(5,10,5,10)); } public Grille getGrille() { return grille; } + + public static void main(String[] args) { + + Puissance4Panel p = new Puissance4Panel(); + + JFrame frame = new JFrame(); + frame.add(p); + frame.setLocation(200, 200); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setSize(new Dimension(1280,720)); + frame.setVisible(true); + } } +