ajout d'un bouton restart

This commit is contained in:
ROGER
2025-05-20 15:13:37 +02:00
parent ec3e46cbe8
commit 4aab505eed
4 changed files with 46 additions and 17 deletions

View File

@@ -19,6 +19,7 @@ public class VueBandeauControle extends JPanel implements Observer {
private JLabel nbLigneLabel;
private JButton quitterButton;
private Jeu jeu;
private JButton relancerButton;
public VueBandeauControle(Jeu jeu) {
this.jeu = jeu;
@@ -53,29 +54,32 @@ public class VueBandeauControle extends JPanel implements Observer {
pauseButton.setMargin(margeBoutton);
quitterButton.setPreferredSize(buttonSize);
quitterButton.setMargin(margeBoutton);
JPanel boutonsPanel = new JPanel();
//boutonsPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 10, 0));
boutonsPanel.setLayout(new BoxLayout(boutonsPanel, BoxLayout.X_AXIS));
boutonsPanel.setOpaque(false);
boutonsPanel.add(pauseButton);
boutonsPanel.add(Box.createRigidArea(new Dimension(10, 0)));
boutonsPanel.add(quitterButton);
JPanel hautBoutonsPanel = new JPanel();
//boutonsPanel.setLayout(new BoxLayout(boutonsPanel, BoxLayout.X_AXIS));
hautBoutonsPanel.setOpaque(false);
hautBoutonsPanel.add(pauseButton);
hautBoutonsPanel.add(Box.createRigidArea(new Dimension(10, 0)));
hautBoutonsPanel.add(quitterButton);
pauseButton.setFocusable(false);
quitterButton.setFocusable(false);
//Relancer button
relancerButton = new JButton("RESTART");
relancerButton.setPreferredSize(buttonSize);
relancerButton.setMargin(margeBoutton);
relancerButton.setFocusable(false);
// AIDE BUTTON
aideButton = new JButton("?");
aideButton.setToolTipText("AFFICHER L'AIDE");
aideButton.setPreferredSize(new Dimension(45, 20));
aideButton.setFocusable(false);
JPanel footerPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 5));
JPanel footerPanel = new JPanel(new BorderLayout());
footerPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, 40));
footerPanel.setOpaque(false);
footerPanel.add(aideButton);
footerPanel.add(relancerButton, BorderLayout.WEST);
footerPanel.add(aideButton, BorderLayout.EAST);
add(Box.createVerticalStrut(20));
add(scoreLabel);
@@ -84,9 +88,8 @@ public class VueBandeauControle extends JPanel implements Observer {
add(Box.createVerticalStrut(20));
add(nextPiecePanel);
add(Box.createVerticalStrut(20));
add(boutonsPanel);
add(hautBoutonsPanel);
add(Box.createVerticalGlue()); //force le JPanel à prendre toute la hauteur
add(footerPanel);
// setVisible(true);
@@ -153,6 +156,10 @@ public class VueBandeauControle extends JPanel implements Observer {
return aideButton;
}
public JButton getRelancerButton() {
return relancerButton;
}
@Override
public void update(Observable o, Object arg) {
if (o instanceof Jeu) {