SAE21_2022/GestionChoixAlgo.java

49 lines
1.7 KiB
Java

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();
AlgoAlea algorithme = new AlgoAlea(this.cetteTaille, this.cetteGrille, this.cetteGrilleCell, null);
algorithme.auto();
}
else if(this.ceGroupe0.getSelection().getActionCommand()=="Adeter" && this.ceGroupe1.getSelection().getActionCommand()=="Vauto")
{
this.frameGrille.dispose();
}
else if(this.ceGroupe0.getSelection().getActionCommand()=="Aalea" && this.ceGroupe1.getSelection().getActionCommand()=="Vman")
{
AlgoAlea algorithme = new AlgoAlea(this.cetteTaille, this.cetteGrille, this.cetteGrilleCell, this.frameGrille);
algorithme.manuel();
}
else if(this.ceGroupe0.getSelection().getActionCommand()=="Adeter" && this.ceGroupe1.getSelection().getActionCommand()=="Vman")
{
}
}
}