boutons acceuil
This commit is contained in:
parent
54accd7952
commit
f858497cc8
@ -18,7 +18,7 @@ public class Main {
|
||||
Grille g = new Grille();
|
||||
GrilleModel m = new GrilleModel();
|
||||
Puissance4Controller p = new Puissance4Controller(g, m);
|
||||
frame.add(menu, "Menu");
|
||||
frame.add(menu, Menu.MENU);
|
||||
frame.add(p.getPanel(), Menu.PUISSANCE_4);
|
||||
frame.setVisible(true);
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import fr.iutfbleau.projetAgile.Menu.Controller.*;
|
||||
|
||||
public abstract class Menu{
|
||||
public static String PUISSANCE_4="puissance4";
|
||||
public static String MENU="Menu";
|
||||
private static JFrame frame=new JFrame("Argile");
|
||||
private static CardLayout cd=new CardLayout();
|
||||
|
||||
@ -129,12 +130,11 @@ public abstract class Menu{
|
||||
*/
|
||||
public static void show(String g) throws IllegalArgumentException
|
||||
{
|
||||
if(g!=Menu.PUISSANCE_4){
|
||||
throw new IllegalArgumentException();
|
||||
if(g==Menu.MENU || g==Menu.PUISSANCE_4){
|
||||
Menu.cd.show(Menu.frame.getContentPane(), g);
|
||||
|
||||
}else{
|
||||
if(g==Menu.PUISSANCE_4){
|
||||
Menu.cd.show(Menu.frame.getContentPane(), g);
|
||||
}
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
@ -0,0 +1,12 @@
|
||||
package fr.iutfbleau.projetAgile.Puissance4.Controller;
|
||||
|
||||
import java.awt.event.*;
|
||||
|
||||
import fr.iutfbleau.projetAgile.Menu.View.Menu;
|
||||
|
||||
public class ObservateurAcceuil implements ActionListener{
|
||||
public ObservateurAcceuil(){}
|
||||
public void actionPerformed(ActionEvent evenement){
|
||||
Menu.show(Menu.MENU);
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@ package fr.iutfbleau.projetAgile.Puissance4.View;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
|
||||
import fr.iutfbleau.projetAgile.Puissance4.Controller.ObservateurAcceuil;
|
||||
import fr.iutfbleau.projetAgile.Puissance4.Utils.Constants;
|
||||
import fr.iutfbleau.projetAgile.Puissance4.Utils.GameStatus;
|
||||
import java.awt.*;
|
||||
@ -40,7 +41,7 @@ public class Puissance4Panel extends JPanel{
|
||||
gbc.weightx = 0;
|
||||
gbc.weighty = 0;
|
||||
gbc.insets = new Insets(0, 0, 0, 0);
|
||||
|
||||
this.menu.addActionListener(new ObservateurAcceuil());
|
||||
this.add(this.menu, gbc);
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user