2023-04-27 21:19:45 +02:00
|
|
|
import javax.swing.*;
|
|
|
|
import java.awt.event.*;
|
|
|
|
|
|
|
|
public class GestionChoixAlgo extends JFrame implements ActionListener {
|
|
|
|
private JFrame cetteFrame;
|
|
|
|
private ButtonGroup ceGroupe0;
|
|
|
|
private ButtonGroup ceGroupe1;
|
|
|
|
|
|
|
|
private int cetteTaille;
|
|
|
|
|
|
|
|
private JFrame frameGrille;
|
|
|
|
private boolean[][] cetteGrille;
|
|
|
|
private Cellules[][] cetteGrilleCell;
|
|
|
|
|
|
|
|
public GestionChoixAlgo(int uneTaille, JFrame uneFrame, ButtonGroup group0, ButtonGroup group1, boolean[][] uneGrille, Cellules[][] grilleCell,JFrame uneFenetre){
|
|
|
|
this.cetteFrame = uneFrame;
|
|
|
|
this.ceGroupe0 = group0;
|
|
|
|
this.ceGroupe1 = group1;
|
|
|
|
|
|
|
|
this.cetteTaille = uneTaille;
|
|
|
|
|
|
|
|
this.frameGrille=uneFenetre;
|
|
|
|
this.cetteGrille = uneGrille;
|
|
|
|
this.cetteGrilleCell=grilleCell;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void actionPerformed(ActionEvent e){
|
|
|
|
this.cetteFrame.dispose();
|
|
|
|
if(this.ceGroupe0.getSelection().getActionCommand()=="Aalea" && this.ceGroupe1.getSelection().getActionCommand()=="Vauto")
|
|
|
|
{
|
|
|
|
this.frameGrille.dispose();
|
2023-04-27 21:23:45 +02:00
|
|
|
AlgoAlea algorithme = new AlgoAlea(this.cetteTaille, this.cetteGrille, this.cetteGrilleCell, null);
|
|
|
|
algorithme.auto();
|
2023-04-27 21:19:45 +02:00
|
|
|
}
|
|
|
|
else if(this.ceGroupe0.getSelection().getActionCommand()=="Adeter" && this.ceGroupe1.getSelection().getActionCommand()=="Vauto")
|
|
|
|
{
|
|
|
|
this.frameGrille.dispose();
|
2023-04-28 05:14:35 +02:00
|
|
|
AlgoDeter algorithme = new AlgoDeter(this.cetteTaille, this.cetteGrille, this.cetteGrilleCell, null);
|
|
|
|
algorithme.auto();
|
2023-04-27 21:19:45 +02:00
|
|
|
}
|
|
|
|
else if(this.ceGroupe0.getSelection().getActionCommand()=="Aalea" && this.ceGroupe1.getSelection().getActionCommand()=="Vman")
|
|
|
|
{
|
2023-04-27 21:23:45 +02:00
|
|
|
AlgoAlea algorithme = new AlgoAlea(this.cetteTaille, this.cetteGrille, this.cetteGrilleCell, this.frameGrille);
|
|
|
|
algorithme.manuel();
|
2023-04-27 21:19:45 +02:00
|
|
|
}
|
|
|
|
else if(this.ceGroupe0.getSelection().getActionCommand()=="Adeter" && this.ceGroupe1.getSelection().getActionCommand()=="Vman")
|
|
|
|
{
|
2023-04-28 05:14:35 +02:00
|
|
|
AlgoDeter algorithme = new AlgoDeter(this.cetteTaille, this.cetteGrille, this.cetteGrilleCell, null);
|
|
|
|
algorithme.manuel();
|
2023-04-27 21:19:45 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|