44 lines
1.2 KiB
Java
44 lines
1.2 KiB
Java
/**
|
|
* La classe <code>FinalScreen</code> est utilisée pour afficher l'écran de fin de partie
|
|
*
|
|
* @version 0.1
|
|
* @author Adil HAMMERSCHMIDT & Lucas GRANDJEAN
|
|
*/
|
|
import javax.swing.*;
|
|
import java.awt.*;
|
|
|
|
public class FinalScreen extends JFrame {
|
|
/**
|
|
* Constructeur déstiné à créer l'écran de fin.
|
|
*
|
|
* @param gameInstance l'instance de jeu
|
|
*/
|
|
public FinalScreen(int score) {
|
|
FinalScreenListener fsListener = new FinalScreenListener(this);
|
|
|
|
JPanel scorePanel = new JPanel();
|
|
JLabel scoreLabel = new JLabel("Votre score : " + String.valueOf(score));
|
|
|
|
scorePanel.add(scoreLabel, JPanel.CENTER_ALIGNMENT);
|
|
|
|
JPanel p = new JPanel();
|
|
p.setLayout(new GridLayout(1,2));
|
|
|
|
JButton restartBtn = new JButton("Revenir");
|
|
JButton exitBtn = new JButton("Quitter");
|
|
|
|
restartBtn.addActionListener(fsListener);
|
|
exitBtn.addActionListener(fsListener);
|
|
|
|
scorePanel.add(scoreLabel);
|
|
p.add(restartBtn);
|
|
p.add(exitBtn);
|
|
|
|
this.add(scorePanel, BorderLayout.NORTH);
|
|
this.add(p);
|
|
this.setPreferredSize(new Dimension(300, 300));
|
|
this.pack();
|
|
this.setLocationRelativeTo(null);
|
|
this.setVisible(true);
|
|
}
|
|
} |