From 78761fdc5eb5d23cdcf321b1776fb1d206b2af8a Mon Sep 17 00:00:00 2001 From: Antoine Guillory Date: Fri, 5 Jan 2018 20:57:20 +0100 Subject: [PATCH] Remove a Bug --- ihm/Home.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ihm/Home.java b/ihm/Home.java index 707cba9..c430084 100644 --- a/ihm/Home.java +++ b/ihm/Home.java @@ -11,27 +11,31 @@ import javax.swing.SwingUtilities; public class Home { + private JFrame mainPanel; + + //Liste des boutons de modes private ArrayList types; public Home(){ + this.mainPanel = new JFrame("Resolution de solitaire chinois"); this.types = new ArrayList(); mainPanel.setVisible(true); mainPanel.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - - mainPanel.pack(); - + JButton type1 = new JButton("Type 1"); JButton type2 = new JButton("Type 2"); + //Si appui démarrage en plateau 1 type1.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ new BoardView(1); } }); + //Si appui démarrage en plateau 2 type2.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ new BoardView(2); @@ -41,11 +45,14 @@ public void actionPerformed(ActionEvent e){ types.add(type1); types.add(type2); + //Place components JPanel p = new JPanel(new FlowLayout(FlowLayout.CENTER)); for(JButton b : types){ p.add(b); } mainPanel.add(p); + mainPanel.pack(); + } public static void main(String[] args) {