Skip to content

Commit

Permalink
Remove a Bug
Browse files Browse the repository at this point in the history
  • Loading branch information
antoineguillory authored Jan 5, 2018
1 parent 8ae731a commit 78761fd
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions ihm/Home.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,31 @@
import javax.swing.SwingUtilities;

public class Home {

private JFrame mainPanel;

//Liste des boutons de modes
private ArrayList<JButton> types;

public Home(){

this.mainPanel = new JFrame("Resolution de solitaire chinois");
this.types = new ArrayList<JButton>();

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);
Expand All @@ -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) {
Expand Down

0 comments on commit 78761fd

Please sign in to comment.