jpanel map

This commit is contained in:
diane 2023-03-27 18:39:26 +02:00
parent cb1b7435af
commit 525e1edaf1
1 changed files with 42 additions and 11 deletions

View File

@ -45,7 +45,7 @@ public class MaJFrame extends JFrame {
private JPanel contentPane;
private static final long serialVersionUID = 7252959164975426293L;
private JPanel panel;
private JPanelImage panel_1;
private JPanel panel_1;
private JLabel lblNewLabel;
private JPanel panel_2;
private JButton btnDeplacer;
@ -60,6 +60,8 @@ public class MaJFrame extends JFrame {
private JLabel lblAttaque;
private JProgressBar progressBarVie;
private JProgressBar progressBarAttaque;
private JPanel panel_4;
private JPanelImage panel_5;
/**
@ -104,7 +106,7 @@ public class MaJFrame extends JFrame {
JButton btnJouer = new JButton("JOUER !");
btnJouer.setForeground(new Color(255, 255, 255));
btnJouer.setBackground(new Color(95, 95, 95));
btnJouer.setBackground(new Color(120, 120, 120));
btnJouer.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
clicBoutonJouer();
@ -113,23 +115,44 @@ public class MaJFrame extends JFrame {
panel.add(btnJouer);
//création panel_1 IMAGE
panel_1 = new JPanelImage("map1.jpg");
panel_1 = new JPanel();
panel_1.setBorder(null);
contentPane.add(panel_1, BorderLayout.CENTER);
panel_1.setLayout(new BorderLayout(0, 0));
GridBagLayout gbl_panel_1 = new GridBagLayout();
gbl_panel_1.columnWidths = new int[] {620, 75, 0};
gbl_panel_1.rowHeights = new int[]{489, 0};
gbl_panel_1.columnWeights = new double[]{0.0, 0.0, Double.MIN_VALUE};
gbl_panel_1.rowWeights = new double[]{0.0, Double.MIN_VALUE};
panel_1.setLayout(gbl_panel_1);
panel_5 = new JPanelImage("map1.jpg");
FlowLayout flowLayout = (FlowLayout) panel_5.getLayout();
flowLayout.setVgap(0);
flowLayout.setHgap(0);
GridBagConstraints gbc_panel_5 = new GridBagConstraints();
gbc_panel_5.insets = new Insets(0, 0, 0, 5);
gbc_panel_5.fill = GridBagConstraints.BOTH;
gbc_panel_5.gridx = 0;
gbc_panel_5.gridy = 0;
panel_1.add(panel_5, gbc_panel_5);
lblNewLabel = new JLabel("ZOMBICIDE");
lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 40));
lblNewLabel.setForeground(new Color(255, 255, 255));
lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
panel_1.add(lblNewLabel, BorderLayout.CENTER);
panel_5.add(lblNewLabel);
lblNewLabel.setVisible(true);
// création panel_2 Boutons
panel_2 = new JPanel();
panel_2.setBackground(new Color(95, 95, 95));
panel_1.add(panel_2, BorderLayout.EAST);
GridBagConstraints gbc_panel_2 = new GridBagConstraints();
gbc_panel_2.fill = GridBagConstraints.BOTH;
gbc_panel_2.gridx = 1;
gbc_panel_2.gridy = 0;
panel_1.add(panel_2, gbc_panel_2);
GridBagLayout gbl_panel_2 = new GridBagLayout();
gbl_panel_2.columnWidths = new int[] {73};
gbl_panel_2.columnWidths = new int[] {75};
gbl_panel_2.rowHeights = new int[] {20, 100, 91, 30, 30, 30, 30, 10, 91, 0};
gbl_panel_2.columnWeights = new double[]{1.0};
gbl_panel_2.rowWeights = new double[]{0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
@ -162,9 +185,9 @@ public class MaJFrame extends JFrame {
panel_2.add(panel_3, gbc_panel_3);
GridBagLayout gbl_panel_3 = new GridBagLayout();
gbl_panel_3.columnWidths = new int[] {30, 10};
gbl_panel_3.rowHeights = new int[] {30, 90};
gbl_panel_3.columnWeights = new double[]{0.0, 0.0};
gbl_panel_3.rowWeights = new double[]{0.0, 0.0};
gbl_panel_3.rowHeights = new int[] {30, 90, 0};
gbl_panel_3.columnWeights = new double[]{1.0, 0.0};
gbl_panel_3.rowWeights = new double[]{0.0, 0.0, 1.0};
panel_3.setLayout(gbl_panel_3);
lblScoreVie = new JLabel("Vies");
@ -205,11 +228,19 @@ public class MaJFrame extends JFrame {
progressBarAttaque.setMaximum(5);
progressBarAttaque.setOrientation(SwingConstants.VERTICAL);
GridBagConstraints gbc_progressBarAttaque = new GridBagConstraints();
gbc_progressBarAttaque.insets = new Insets(0, 0, 5, 5);
gbc_progressBarAttaque.insets = new Insets(0, 0, 5, 0);
gbc_progressBarAttaque.fill = GridBagConstraints.VERTICAL;
gbc_progressBarAttaque.gridx = 1;
gbc_progressBarAttaque.gridy = 1;
panel_3.add(progressBarAttaque, gbc_progressBarAttaque);
panel_4 = new JPanel();
GridBagConstraints gbc_panel_4 = new GridBagConstraints();
gbc_panel_4.insets = new Insets(0, 0, 0, 5);
gbc_panel_4.fill = GridBagConstraints.BOTH;
gbc_panel_4.gridx = 0;
gbc_panel_4.gridy = 2;
panel_3.add(panel_4, gbc_panel_4);
GridBagConstraints gbc_btnDeplacer = new GridBagConstraints();
gbc_btnDeplacer.fill = GridBagConstraints.BOTH;
gbc_btnDeplacer.insets = new Insets(0, 0, 5, 0);