Tout finit + retravail certain points

This commit is contained in:
fauvet 2023-04-28 19:17:35 +02:00
parent 879a69444c
commit bc5bda4150
9 changed files with 31 additions and 13 deletions

View File

@ -1,6 +1,5 @@
import java.awt.Color;
import javax.swing.JComponent;
import java.awt.Graphics;
public class Cellules extends JComponent{

View File

@ -11,6 +11,7 @@ public class ChoixAlgo extends Fenetre {
super();
this.fenetre.setVisible(true);
this.fenetre.setTitle("Algorithmes et visualisation");
this.fenetre.setLocation(1000, 200);
this.ceTableau = uneGrille;
this.cetteGrille = uneGrilleCell;

View File

@ -18,6 +18,7 @@ public class FenetreImpGrille extends Fenetre {
/* =============================================================== Gestion des paramètres de la fenètre ========================================================================== */
/*Création de la fenètre */
this.fenetre.setSize(600, 600);
this.fenetre.setLocation(300, 150);
/*Mise en place du grid layout */
GridLayout gestionnaire = new GridLayout(taille,taille);
this.fenetre.setLayout(gestionnaire);

View File

@ -25,7 +25,7 @@ public class FenetreRndmGrille extends Fenetre{
public void randomGrille(){
this.fenetre.setSize(600, 600);
this.fenetre.setLocation(450, 200);
this.fenetre.setLocation(300, 150);
GridLayout gestionnaire = new GridLayout(this.taille,this.taille);
this.fenetre.setLayout(gestionnaire);

View File

@ -21,7 +21,7 @@ public class FenetreVideGrille extends Fenetre{
public void videGrille(){
this.fenetre.setSize(600, 600);
this.fenetre.setLocation(450, 200);
this.fenetre.setLocation(300, 150);
GridLayout gestionnaire = new GridLayout(this.taille,this.taille);
this.fenetre.setLayout(gestionnaire);
@ -33,7 +33,7 @@ public class FenetreVideGrille extends Fenetre{
for(int i=0; i<taille; i++){
for(int j=0; j<taille; j++){
grille[i][j] = true;
grille[i][j] = Cellules.LIBRE;
this.modif = new Modifications(interfacePanel, grille,this.tabCouleur);

View File

@ -3,18 +3,27 @@ import java.io.File;
public class FileImport {
private String ce_chemin;
public FileImport(){
this.ce_chemin = "";
};
}
public String Parcours(){
JFileChooser fileChooser = new JFileChooser();
int option = fileChooser.showOpenDialog(null);
if (option == JFileChooser.APPROVE_OPTION) {
File selectedFile = fileChooser.getSelectedFile();
this.ce_chemin = selectedFile.getAbsolutePath();
} else {
System.out.println("No file selected");
try {
int option = fileChooser.showOpenDialog(null);
if (option == JFileChooser.APPROVE_OPTION) {
File selectedFile = fileChooser.getSelectedFile();
this.ce_chemin = selectedFile.getAbsolutePath();
} else {
System.out.println("Aucun fichier sélectionné");
}
} catch (Exception e) {
System.out.println("Voici l'eereur rencontrée: " + e.getMessage());
this.ce_chemin = "";
}
return this.ce_chemin;
}
}
}

View File

@ -40,11 +40,13 @@ public class GestionChoixAlgo extends JFrame implements ActionListener {
}
else if(this.ceGroupe0.getSelection().getActionCommand()=="Aalea" && this.ceGroupe1.getSelection().getActionCommand()=="Vman")
{
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")
{
this.frameGrille.setLocation(500, 100);
AlgoDeter algorithme = new AlgoDeter(this.cetteTaille, this.cetteGrille, this.cetteGrilleCell, null);
algorithme.manuel();
}

View File

@ -14,7 +14,7 @@ public class PanneauModification extends Fenetre {
public PanneauModification(boolean[][] uneGrille, int uneTaille, Cellules[][] uneGrilleCell, JFrame uneFrame){
super();
this.fenetre.setSize(400, 600);
this.fenetre.setLocation(1100, 200);
this.fenetre.setLocation(920, 150);
this.grilleCellules = uneGrilleCell;
this.cetteGrille=uneGrille;
this.cetteTaille=uneTaille;

View File

@ -1,5 +1,6 @@
import java.awt.event.*;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
public class Importer implements ActionListener {
String cette_option;
@ -25,6 +26,11 @@ public class Importer implements ActionListener {
FileImport un_test = new FileImport();
this.ce_chemin = un_test.Parcours();
if(this.ce_chemin == ""){
JOptionPane.showMessageDialog(null, "Aucun fichier n'a été importé, le programme va se clore a la suite de cette fenetre", "Erreur d'importation", JOptionPane.ERROR_MESSAGE);
System.exit(1);
}
/*lecture du fichier */
this.cette_lecture = new Lecture(this.ce_chemin);