ok
This commit is contained in:
parent
707a5da5c4
commit
5852f31cd2
@ -13,6 +13,6 @@ public class ObservateurAccueil implements ActionListener{
|
||||
public void actionPerformed(ActionEvent evenement){
|
||||
int confirmation = JOptionPane.showConfirmDialog(this.comp, "Etes-vous sûr de vouloir retourner au menu ?", "Menu", JOptionPane.YES_NO_OPTION);
|
||||
if(confirmation == 1) return;
|
||||
Menu.show(Menu.MENU, this.comp);
|
||||
Menu.show(Menu.MENU);
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ public class ObservateurMenuSouris implements MouseListener{
|
||||
public void mouseClicked(MouseEvent evenement){
|
||||
BoutonsMenu bout=(BoutonsMenu) (evenement.getComponent());
|
||||
if(bout.getPath()==Menu.PUISSANCE_4){
|
||||
Menu.show(Menu.PUISSANCE_4, null);
|
||||
Menu.show(Menu.PUISSANCE_4);
|
||||
}
|
||||
} // un bouton cliqué
|
||||
public void mouseEntered(MouseEvent evenement){
|
||||
|
@ -7,13 +7,13 @@ import javax.swing.JLabel;
|
||||
import fr.iutfbleau.projetAgile.Menu.Controller.*;
|
||||
import fr.iutfbleau.projetAgile.Puissance4.LancementPartie;
|
||||
import java.awt.event.WindowListener;
|
||||
import java.util.concurrent.CancellationException;
|
||||
|
||||
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();
|
||||
private static String JEU="Jeu";
|
||||
|
||||
/**
|
||||
* methode static pour avoir le JPanel Affichant le Menu
|
||||
@ -127,31 +127,25 @@ public abstract class Menu{
|
||||
*
|
||||
* @param g
|
||||
* le string de la carte correspondant
|
||||
* @throws IllegalArgumentException
|
||||
* si l'argument ne correspond pas a une Carte
|
||||
|
||||
*/
|
||||
public static void show(String g, Component composent) throws IllegalArgumentException
|
||||
public static void show(String g)
|
||||
{
|
||||
if((g==Menu.MENU || g==Menu.PUISSANCE_4)){
|
||||
if(g!=Menu.MENU){
|
||||
if(g==Menu.MENU)
|
||||
Menu.cd.show(Menu.frame.getContentPane(), g);
|
||||
else{
|
||||
if(g==Menu.PUISSANCE_4){
|
||||
try {
|
||||
try{
|
||||
LancementPartie lm=new LancementPartie(Menu.frame);
|
||||
lm.accueilButton(new ObservateurAccueil(lm.getPanel()));
|
||||
Menu.frame.add(lm.getPanel(), Menu.PUISSANCE_4);
|
||||
Menu.cd.show(Menu.frame.getContentPane(), g);
|
||||
} catch (CancellationException e) {
|
||||
Menu.frame.add(lm.getPanel(), Menu.JEU);
|
||||
}catch(Exception e){
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
Menu.cd.show(Menu.frame.getContentPane(), Menu.JEU);
|
||||
}
|
||||
else{
|
||||
Menu.cd.removeLayoutComponent(composent);
|
||||
}
|
||||
}else{
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
}
|
||||
/**
|
||||
@ -163,6 +157,7 @@ public abstract class Menu{
|
||||
if(Menu.frame.getLayout()!=Menu.cd){
|
||||
Menu.frame.setLayout(Menu.cd);
|
||||
Menu.frame.setMinimumSize(new Dimension(1280,720));
|
||||
Menu.frame.setLocation(200,200);
|
||||
}
|
||||
WindowListener[] wl=Menu.frame.getWindowListeners();
|
||||
if(wl.length==0){
|
||||
|
Loading…
Reference in New Issue
Block a user