This commit is contained in:
dagorne 2022-10-17 13:42:19 +02:00
parent 3f4f2fa25d
commit 58548c4ef8
3 changed files with 37 additions and 4 deletions

View File

@ -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/*

View File

@ -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;

View File

@ -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);
}
}