bouton campagne
This commit is contained in:
@@ -3,12 +3,12 @@ package linea;
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
|
||||
public class MenuPrincipal extends JPanel{
|
||||
public class MenuPrincipal extends JPanel {
|
||||
private JButton btnPlay;
|
||||
private JButton btnCampaign; // Nouveau bouton
|
||||
private JButton btnSettings;
|
||||
private JButton btnQuit;
|
||||
|
||||
|
||||
public MenuPrincipal(Jeu jeu) {
|
||||
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
|
||||
setBackground(new Color(45, 45, 45)); // Gris foncé
|
||||
@@ -19,22 +19,30 @@ public class MenuPrincipal extends JPanel{
|
||||
titre.setFont(new Font("SansSerif", Font.BOLD, 60));
|
||||
titre.setAlignmentX(Component.CENTER_ALIGNMENT);
|
||||
|
||||
// Boutons
|
||||
// Création des Boutons
|
||||
btnPlay = creerBouton("PLAY");
|
||||
btnCampaign = creerBouton("CAMPAGNES"); // Création
|
||||
btnSettings = creerBouton("SETTINGS");
|
||||
btnQuit = creerBouton("QUIT");
|
||||
|
||||
// Actions
|
||||
btnPlay.addActionListener(e -> jeu.lancerPartie());
|
||||
|
||||
// Action pour aller vers le menu campagne
|
||||
// (Assure-toi d'avoir cette méthode dans ta classe Jeu)
|
||||
btnCampaign.addActionListener(e -> jeu.afficherMenuCampagne());
|
||||
|
||||
btnSettings.addActionListener(e -> JOptionPane.showMessageDialog(this, "Options bientôt disponibles !"));
|
||||
btnQuit.addActionListener(e -> System.exit(0));
|
||||
|
||||
// Mise en page (espacement)
|
||||
// Mise en page (espacement vertical)
|
||||
add(Box.createVerticalGlue());
|
||||
add(titre);
|
||||
add(Box.createRigidArea(new Dimension(0, 50)));
|
||||
add(btnPlay);
|
||||
add(Box.createRigidArea(new Dimension(0, 15)));
|
||||
add(btnCampaign); // Ajout à l'affichage
|
||||
add(Box.createRigidArea(new Dimension(0, 15)));
|
||||
add(btnSettings);
|
||||
add(Box.createRigidArea(new Dimension(0, 15)));
|
||||
add(btnQuit);
|
||||
@@ -46,7 +54,7 @@ public class MenuPrincipal extends JPanel{
|
||||
b.setFont(new Font("SansSerif", Font.PLAIN, 20));
|
||||
b.setAlignmentX(Component.CENTER_ALIGNMENT);
|
||||
b.setMaximumSize(new Dimension(200, 50));
|
||||
b.setFocusable(false); // Pour ne pas voler le focus du clavier plus tard
|
||||
b.setFocusable(false);
|
||||
return b;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user