2026-03-30 22:33:20 +02:00
|
|
|
import javax.swing.*;
|
|
|
|
|
import java.awt.*;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class FenetreJeu extends JFrame {
|
|
|
|
|
|
|
|
|
|
private Grille grille;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public FenetreJeu(Grille g) {
|
|
|
|
|
super("Démineur - Partie en cours");
|
|
|
|
|
this.grille = g;
|
|
|
|
|
|
|
|
|
|
this.setSize(600, 600);
|
|
|
|
|
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
|
|
|
|
this.setLayout(new BorderLayout());
|
|
|
|
|
|
|
|
|
|
JPanel panneauGrille = new JPanel();
|
2026-04-03 16:56:08 +02:00
|
|
|
panneauGrille.setLayout(new GridLayout(g.getLignes(), g.getColonnes()));
|
2026-03-30 22:33:20 +02:00
|
|
|
|
2026-04-03 16:56:08 +02:00
|
|
|
for (int i = 0; i < g.getLignes(); i++) {
|
|
|
|
|
for (int j = 0; j < g.getColonnes(); j++) {
|
2026-03-30 22:33:20 +02:00
|
|
|
JButton boutonCase = new JButton("?");
|
|
|
|
|
panneauGrille.add(boutonCase);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.add(panneauGrille, BorderLayout.CENTER);
|
2026-04-03 16:56:08 +02:00
|
|
|
|
|
|
|
|
JButton btnSauverQuitter = new JButton("Sauver et Quitter");
|
|
|
|
|
this.add(btnSauverQuitter, BorderLayout.SOUTH);
|
|
|
|
|
|
|
|
|
|
ControleurJeu controleur = new ControleurJeu(this);
|
|
|
|
|
btnSauverQuitter.addActionListener(controleur);
|
2026-03-30 22:33:20 +02:00
|
|
|
}
|
|
|
|
|
}
|