SAE21_2022/GestionChoixAlgo.java

59 lines
2.3 KiB
Java
Raw Normal View History

import javax.swing.*;
import java.awt.event.*;
2023-04-28 20:26:02 +02:00
/**
* La class Attente inclu un KeyListener, cette classe a pour objectif d'attendre une entré sur la touche espace du clavier
* pour regarder le parcours qu'emprunte l'algorithme
* @version 1.1
* @author Matthis Fauvet
*/
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();
AlgoDeter algorithme = new AlgoDeter(this.cetteTaille, this.cetteGrille, this.cetteGrilleCell, null);
algorithme.auto();
}
else if(this.ceGroupe0.getSelection().getActionCommand()=="Aalea" && this.ceGroupe1.getSelection().getActionCommand()=="Vman")
{
2023-04-28 19:17:35 +02:00
this.frameGrille.setLocation(500, 100);
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")
{
2023-04-28 19:17:35 +02:00
this.frameGrille.setLocation(500, 100);
AlgoDeter algorithme = new AlgoDeter(this.cetteTaille, this.cetteGrille, this.cetteGrilleCell, null);
algorithme.manuel();
}
}
}