2023-04-18 12:29:43 +02:00
|
|
|
import java.awt.event.*;
|
|
|
|
import javax.swing.JFrame;
|
|
|
|
|
2023-04-23 23:34:51 +02:00
|
|
|
public class Importer implements ActionListener {
|
2023-04-18 12:29:43 +02:00
|
|
|
String cette_option;
|
|
|
|
String cet_event;
|
|
|
|
String ce_chemin;
|
|
|
|
JFrame cette_frame;
|
|
|
|
Lecture cette_lecture;
|
|
|
|
FenetreImpGrille cette_fenetre;
|
|
|
|
int valeur0, valeur1, valeur2, valeur3, valeur4;
|
|
|
|
|
|
|
|
|
2023-04-23 23:34:51 +02:00
|
|
|
public Importer(JFrame une_frame){
|
2023-04-18 12:29:43 +02:00
|
|
|
this.cette_option="Importer Grille";
|
|
|
|
this.cette_frame = une_frame;
|
|
|
|
}
|
|
|
|
|
2023-04-19 19:13:00 +02:00
|
|
|
public void actionPerformed(ActionEvent e){
|
|
|
|
this.cet_event=e.getActionCommand();
|
|
|
|
if(cet_event.equals(this.cette_option)){
|
2023-04-26 10:54:36 +02:00
|
|
|
//System.out.println("Importation de la grille");
|
2023-04-18 12:29:43 +02:00
|
|
|
|
2023-04-19 19:13:00 +02:00
|
|
|
/*cherche le chemin du fichier */
|
|
|
|
FileImport un_test = new FileImport();
|
|
|
|
this.ce_chemin = un_test.Parcours();
|
2023-04-18 12:29:43 +02:00
|
|
|
|
2023-04-19 19:13:00 +02:00
|
|
|
/*lecture du fichier */
|
|
|
|
this.cette_lecture = new Lecture(this.ce_chemin);
|
2023-04-18 18:38:32 +02:00
|
|
|
|
2023-04-19 19:13:00 +02:00
|
|
|
this.valeur0=this.cette_lecture.GetHeader(0);
|
|
|
|
this.valeur1=this.cette_lecture.GetHeader(1);
|
|
|
|
this.valeur2=this.cette_lecture.GetHeader(2);
|
|
|
|
this.valeur3=this.cette_lecture.GetHeader(3);
|
|
|
|
this.valeur4=this.cette_lecture.GetHeader(4);
|
2023-04-18 12:29:43 +02:00
|
|
|
|
2023-04-19 19:13:00 +02:00
|
|
|
/*Fermeture de la première fenètre */
|
|
|
|
cette_frame.dispose();
|
2023-04-18 12:29:43 +02:00
|
|
|
|
2023-04-19 19:13:00 +02:00
|
|
|
/* Ouverture de la nouvelle */
|
2023-04-18 12:29:43 +02:00
|
|
|
|
2023-04-19 19:13:00 +02:00
|
|
|
this.cette_fenetre = new FenetreImpGrille();
|
2023-04-18 12:29:43 +02:00
|
|
|
|
2023-04-19 19:13:00 +02:00
|
|
|
cette_fenetre.ImporterGrille(this.valeur0, this.valeur1, this.valeur2, this.valeur3, this.valeur4, this.cette_lecture.GetOffset());
|
2023-04-18 12:29:43 +02:00
|
|
|
}
|
2023-04-19 19:13:00 +02:00
|
|
|
}
|
2023-04-18 12:29:43 +02:00
|
|
|
}
|