UPDATE 1>10 - Creation bon GIT - voir SAE21_2023
This commit is contained in:
parent
2d542997bf
commit
180a4e23fe
21
.vscode/launch.json
vendored
Normal file
21
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "java",
|
||||
"name": "Current File",
|
||||
"request": "launch",
|
||||
"mainClass": "${file}"
|
||||
},
|
||||
{
|
||||
"type": "java",
|
||||
"name": "test",
|
||||
"request": "launch",
|
||||
"mainClass": "test",
|
||||
"projectName": "SAE21_2023_49188ab1"
|
||||
}
|
||||
]
|
||||
}
|
26
Exporter.java
Normal file
26
Exporter.java
Normal file
@ -0,0 +1,26 @@
|
||||
import javax.swing.JPanel;
|
||||
|
||||
public class Exporter {
|
||||
private int[] infos_grille;
|
||||
private JPanel[][] composanteGrille;
|
||||
private FenetreRndmGrille cetteFrg;
|
||||
private int Taille;
|
||||
|
||||
public Exporter(FenetreRndmGrille uneFrg){
|
||||
this.cetteFrg = uneFrg;
|
||||
}
|
||||
|
||||
protected void jsp(){
|
||||
this.infos_grille=this.cetteFrg.get_info();
|
||||
this.Taille=this.infos_grille[0];
|
||||
this.composanteGrille=this.cetteFrg.getGrille();
|
||||
for(int i=0; i<this.infos_grille.length;i++){
|
||||
System.out.println(i+" elt : "+this.infos_grille[i]);
|
||||
}
|
||||
for(int i=0; i<this.Taille;i++){
|
||||
for(int j=0; j<this.Taille; j++){
|
||||
System.out.println("la couleur que je ne vois pas haha : "+this.composanteGrille[i][j].getBackground());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
17
Fenetre.java
Normal file
17
Fenetre.java
Normal file
@ -0,0 +1,17 @@
|
||||
import javax.swing.*;
|
||||
|
||||
public class Fenetre extends JFrame{
|
||||
protected JFrame fenetre;
|
||||
|
||||
public Fenetre() {
|
||||
this.fenetre = new JFrame("Creation du programme");
|
||||
this.fenetre.setSize(400, 500);
|
||||
this.fenetre.setLocationRelativeTo(null); // centre la fenêtre sur l'écran
|
||||
|
||||
this.fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
}
|
||||
|
||||
protected void closeFrame() {
|
||||
dispose();
|
||||
}
|
||||
}
|
81
FenetreDefSize.java
Normal file
81
FenetreDefSize.java
Normal file
@ -0,0 +1,81 @@
|
||||
import javax.swing.*;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class FenetreDefSize extends Fenetre{
|
||||
|
||||
public FenetreDefSize(){
|
||||
super();
|
||||
}
|
||||
|
||||
protected void MiseEnPlace(){
|
||||
/*============================== --------------- Fenetre --------------- ==============================*/
|
||||
|
||||
GridLayout gestionnaire = new GridLayout(2,1);
|
||||
this.fenetre.setLayout(gestionnaire);
|
||||
|
||||
/*============================== --------------- premier panneau --------------- ==============================*/
|
||||
|
||||
JPanel ce_panneau = new JPanel();
|
||||
ce_panneau.setBackground(Color.CYAN);
|
||||
|
||||
JLabel ce_text = new JLabel("Donnez la taille de la grille");
|
||||
|
||||
ce_panneau.add(ce_text);
|
||||
|
||||
/* ============================== --------------- deuxième panneau --------------- ==============================*/
|
||||
|
||||
JPanel ce_panneau2 = new JPanel();
|
||||
ce_panneau2.setBackground(Color.CYAN);
|
||||
|
||||
ce_panneau2.setLayout(gestionnaire);
|
||||
|
||||
/*----------------- Panneau 3 -----------------*/
|
||||
JPanel ce_panneau3 = new JPanel();
|
||||
ce_panneau3.setBackground(Color.CYAN);
|
||||
|
||||
|
||||
JTextField ce_champ = new JTextField();
|
||||
ce_champ.setPreferredSize(new Dimension(50, 30));
|
||||
JButton ce_boutton = new JButton("créer");
|
||||
|
||||
ce_panneau3.add(ce_champ);
|
||||
ce_panneau3.add(ce_boutton);
|
||||
|
||||
/*----------------- Panneau 4 - les radios boutons -----------------*/
|
||||
JPanel ce_panneau4 = new JPanel();
|
||||
ce_panneau4.setBackground(Color.CYAN);
|
||||
|
||||
JRadioButton radio1 = new JRadioButton("Grille randomisée");
|
||||
JRadioButton radio2 = new JRadioButton("Grille vide");
|
||||
|
||||
radio1.setSelected(true);
|
||||
|
||||
radio1.setBackground(Color.CYAN);
|
||||
radio2.setBackground(Color.CYAN);
|
||||
|
||||
radio1.setActionCommand("Grille randomisée");
|
||||
radio2.setActionCommand("Grille vide");
|
||||
|
||||
ButtonGroup group = new ButtonGroup();
|
||||
group.add(radio1);
|
||||
group.add(radio2);
|
||||
|
||||
ce_panneau4.add(radio1);
|
||||
ce_panneau4.add(radio2);
|
||||
|
||||
/* ----------------- Global ----------------- */
|
||||
ce_panneau2.add(ce_panneau3);
|
||||
ce_panneau2.add(ce_panneau4);
|
||||
|
||||
/*----------------- event -----------------*/
|
||||
taille_su b_taille = new taille_su(this.fenetre, ce_champ, group);
|
||||
ce_boutton.addActionListener(b_taille);
|
||||
|
||||
/*----------------- reste -----------------*/
|
||||
this.fenetre.add(ce_panneau, BorderLayout.CENTER);
|
||||
this.fenetre.add(ce_panneau2);
|
||||
|
||||
this.fenetre.setVisible(true);
|
||||
}
|
||||
}
|
68
FenetreImpGrille.java
Normal file
68
FenetreImpGrille.java
Normal file
@ -0,0 +1,68 @@
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
|
||||
public class FenetreImpGrille extends Fenetre {
|
||||
|
||||
protected FenetreImpGrille(){
|
||||
super();
|
||||
}
|
||||
|
||||
protected void ImporterGrille(int Taille, int Lentre, int Centre, int Lortie, int Cortie, int[] un_tab){
|
||||
/* ================================================================ Déclaration des variables ============================================================================= */
|
||||
|
||||
int compteur=0;
|
||||
int[][] ce_double_tab = new int[Taille][Taille];
|
||||
|
||||
/* =============================================================== Gestion des paramètres de la fenètre ========================================================================== */
|
||||
|
||||
/*Création de la fenètre */
|
||||
this.fenetre.setSize(600, 600);
|
||||
|
||||
/*Mise en place du grid layout */
|
||||
GridLayout gestionnaire = new GridLayout(Taille,Taille);
|
||||
this.fenetre.setLayout(gestionnaire);
|
||||
|
||||
/* ================================================================================================================================================================ */
|
||||
|
||||
|
||||
/* remplissage du tab 1 */
|
||||
|
||||
for(int i=0; i<Taille; i++){
|
||||
for(int j=0; j<Taille; j++){
|
||||
ce_double_tab[j][i] = un_tab[compteur];
|
||||
compteur++;
|
||||
}
|
||||
}
|
||||
|
||||
/* ======================================================================================================================================= */
|
||||
|
||||
// Gestion du remplissage des case
|
||||
|
||||
for(int i=0; i<Taille; i++){
|
||||
for(int j=0; j<Taille; j++){
|
||||
|
||||
JPanel ce_pannel = new JPanel();
|
||||
|
||||
if((i*4+j)==(Lentre*4+Centre)){
|
||||
ce_pannel.setBackground(Color.RED);
|
||||
this.fenetre.add(ce_pannel);
|
||||
} else if((i*4+j)==(Lortie*4+Cortie)){
|
||||
ce_pannel.setBackground(Color.BLUE);
|
||||
this.fenetre.add(ce_pannel);
|
||||
} else if(ce_double_tab[i][j] == 1){
|
||||
ce_pannel.setBackground(Color.BLACK);
|
||||
this.fenetre.add(ce_pannel);
|
||||
} else{
|
||||
JPanel ce_panel = new JPanel();
|
||||
Border border = BorderFactory.createLineBorder(Color.BLACK, 1);
|
||||
ce_panel.setBorder(border);
|
||||
ce_panel.setBackground(Color.WHITE);
|
||||
this.fenetre.add(ce_panel);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.fenetre.setVisible(true);
|
||||
|
||||
}
|
||||
}
|
57
FenetreInit.java
Normal file
57
FenetreInit.java
Normal file
@ -0,0 +1,57 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class FenetreInit extends Fenetre
|
||||
{
|
||||
public FenetreInit(){
|
||||
super();
|
||||
}
|
||||
|
||||
protected void Initialisation(){
|
||||
GridLayout gestionnaire = new GridLayout(2,1);
|
||||
this.fenetre.setLayout(gestionnaire);
|
||||
|
||||
/* Création du premier panneau */
|
||||
|
||||
JLabel un_text = new JLabel("Que voulez vous faire ?");
|
||||
|
||||
JPanel un_Panel = new JPanel();
|
||||
un_Panel.setBackground(Color.CYAN);
|
||||
|
||||
un_Panel.add(un_text, BorderLayout.CENTER);
|
||||
|
||||
JPanel un_Panel2 = new JPanel(null);
|
||||
un_Panel2.setBackground(Color.CYAN);
|
||||
un_Panel2.setLayout(new BoxLayout(un_Panel2, BoxLayout.Y_AXIS));
|
||||
un_Panel2.add(Box.createVerticalGlue());
|
||||
un_Panel2.add(un_Panel);
|
||||
un_Panel2.add(Box.createVerticalGlue());
|
||||
|
||||
/*Création du deuxième panneau */
|
||||
JPanel un_Panel3 = new JPanel();
|
||||
FlowLayout gestionnaire2 = new FlowLayout(FlowLayout.CENTER);
|
||||
un_Panel3.setLayout(gestionnaire2);
|
||||
un_Panel3.setBackground(Color.CYAN);
|
||||
JButton un_Button0 = new JButton("Nouvelle Grille");
|
||||
JButton un_Button1 = new JButton("Importer Grille");
|
||||
|
||||
un_Panel3.add(un_Button0);
|
||||
un_Panel3.add(un_Button1);
|
||||
|
||||
/*Gestion des événements */
|
||||
|
||||
creer salut = new creer(fenetre);
|
||||
un_Button0.addActionListener(salut);
|
||||
|
||||
importer bImporter = new importer(this.fenetre);
|
||||
un_Button1.addActionListener(bImporter);
|
||||
|
||||
/*Ajouts des elts à la fenètre */
|
||||
|
||||
this.fenetre.add(un_Panel2, BorderLayout.CENTER);
|
||||
this.fenetre.add(un_Panel3);
|
||||
|
||||
this.fenetre.setVisible(true);
|
||||
}
|
||||
|
||||
}
|
116
FenetreRndmGrille.java
Normal file
116
FenetreRndmGrille.java
Normal file
@ -0,0 +1,116 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.Random;
|
||||
import javax.swing.border.Border;
|
||||
|
||||
public class FenetreRndmGrille extends Fenetre{
|
||||
private int[] tab_de_int;
|
||||
private int Taille;
|
||||
private int ValeurEntre;
|
||||
private int ValeurSortie;
|
||||
|
||||
private JPanel[][] TabDePanel;
|
||||
|
||||
public FenetreRndmGrille(int Taille){
|
||||
super();
|
||||
this.tab_de_int = new int[] {1, 1};
|
||||
this.Taille = Taille;
|
||||
this.TabDePanel = new JPanel[this.Taille][this.Taille];
|
||||
}
|
||||
|
||||
protected void RandomGrille(){
|
||||
this.fenetre.setSize(600, 600);
|
||||
this.fenetre.setLocation(450, 200);
|
||||
|
||||
GridLayout gestionnaire = new GridLayout(this.Taille,this.Taille);
|
||||
this.fenetre.setLayout(gestionnaire);
|
||||
|
||||
OptionsFRG un_Test = new OptionsFRG(this);
|
||||
un_Test.SetUp();
|
||||
|
||||
Random rand = new Random();
|
||||
this.ValeurEntre = rand.nextInt(this.Taille*this.Taille);
|
||||
this.ValeurSortie = rand.nextInt(this.Taille*this.Taille);
|
||||
if(this.ValeurSortie == this.ValeurEntre){
|
||||
while(this.ValeurSortie == this.ValeurEntre)
|
||||
{
|
||||
this.ValeurSortie = rand.nextInt(this.Taille*this.Taille);
|
||||
}
|
||||
}
|
||||
|
||||
int compteur=0;
|
||||
|
||||
for(int i=0; i<Taille; i++){
|
||||
for(int j=0; j<Taille; j++){
|
||||
int nombreAleatoire = rand.nextInt(3); // génère un nombre entre 0 et 10
|
||||
|
||||
JPanel ce_panel = new JPanel();
|
||||
this.TabDePanel[j][i] = ce_panel;
|
||||
|
||||
if(compteur==this.ValeurEntre){
|
||||
Border border = BorderFactory.createLineBorder(Color.BLACK, 1);
|
||||
ce_panel.setBorder(border);
|
||||
ce_panel.setBackground(Color.BLUE);
|
||||
this.fenetre.add(ce_panel);
|
||||
|
||||
ModificationsFRG testee = new ModificationsFRG(un_Test, this.tab_de_int);
|
||||
ce_panel.addMouseListener(testee);
|
||||
|
||||
this.tab_de_int=testee.getValues();
|
||||
|
||||
} else if(compteur==this.ValeurSortie){
|
||||
Border border = BorderFactory.createLineBorder(Color.BLACK, 1);
|
||||
ce_panel.setBorder(border);
|
||||
ce_panel.setBackground(Color.RED);
|
||||
this.fenetre.add(ce_panel);
|
||||
|
||||
ModificationsFRG testee = new ModificationsFRG(un_Test, this.tab_de_int);
|
||||
ce_panel.addMouseListener(testee);
|
||||
|
||||
this.tab_de_int=testee.getValues();
|
||||
|
||||
} else if(nombreAleatoire == 0){
|
||||
Border border = BorderFactory.createLineBorder(Color.BLACK, 1);
|
||||
ce_panel.setBorder(border);
|
||||
ce_panel.setBackground(Color.BLACK);
|
||||
this.fenetre.add(ce_panel);
|
||||
|
||||
ModificationsFRG testee = new ModificationsFRG(un_Test, this.tab_de_int);
|
||||
ce_panel.addMouseListener(testee);
|
||||
|
||||
this.tab_de_int=testee.getValues();
|
||||
|
||||
} else{
|
||||
Border border = BorderFactory.createLineBorder(Color.BLACK, 1);
|
||||
ce_panel.setBorder(border);
|
||||
ce_panel.setBackground(Color.WHITE);
|
||||
this.fenetre.add(ce_panel);
|
||||
|
||||
ModificationsFRG testee = new ModificationsFRG(un_Test, this.tab_de_int);
|
||||
ce_panel.addMouseListener(testee);
|
||||
|
||||
this.tab_de_int=testee.getValues();
|
||||
}
|
||||
|
||||
compteur++;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
this.fenetre.setVisible(true);
|
||||
}
|
||||
|
||||
protected int[] get_info(){
|
||||
int[] infos_grille = new int[5];
|
||||
infos_grille[0] = this.Taille;
|
||||
infos_grille[1] = (this.ValeurEntre/this.Taille);
|
||||
infos_grille[2] = (this.ValeurEntre%this.Taille);
|
||||
infos_grille[3] = (this.ValeurSortie/this.Taille);
|
||||
infos_grille[4] = (this.ValeurSortie%this.Taille);
|
||||
return infos_grille;
|
||||
}
|
||||
|
||||
protected JPanel[][] getGrille(){
|
||||
return this.TabDePanel;
|
||||
}
|
||||
}
|
38
FenetreVideGrille.java
Normal file
38
FenetreVideGrille.java
Normal file
@ -0,0 +1,38 @@
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
|
||||
public class FenetreVideGrille extends Fenetre{
|
||||
private int[] tab_de_int;
|
||||
|
||||
public FenetreVideGrille(){
|
||||
super();
|
||||
this.tab_de_int = new int[] {0, 0};
|
||||
}
|
||||
|
||||
protected void create_empty(int Taille){
|
||||
this.fenetre.setSize(600, 600);
|
||||
this.fenetre.setLocation(450, 200);
|
||||
|
||||
OptionsFVG un_Test = new OptionsFVG(this);
|
||||
un_Test.set_up();
|
||||
|
||||
GridLayout gestionnaire = new GridLayout(Taille,Taille);
|
||||
this.fenetre.setLayout(gestionnaire);
|
||||
|
||||
for(int i=0; i<Taille; i++){
|
||||
for(int j=0; j<Taille; j++){
|
||||
JPanel ce_panel = new JPanel();
|
||||
Border border = BorderFactory.createLineBorder(Color.BLACK, 1);
|
||||
ce_panel.setBorder(border);
|
||||
ce_panel.setBackground(Color.WHITE);
|
||||
this.fenetre.add(ce_panel);
|
||||
|
||||
ModificationsFVG testee = new ModificationsFVG(un_Test, this.tab_de_int);
|
||||
ce_panel.addMouseListener(testee);
|
||||
this.tab_de_int=testee.getValues();
|
||||
}
|
||||
}
|
||||
this.fenetre.setVisible(true);
|
||||
}
|
||||
}
|
22
FileImport.java
Normal file
22
FileImport.java
Normal file
@ -0,0 +1,22 @@
|
||||
import javax.swing.*;
|
||||
import java.io.File;
|
||||
|
||||
public class FileImport {
|
||||
String ce_chemin;
|
||||
public FileImport(){
|
||||
this.ce_chemin = "";
|
||||
};
|
||||
|
||||
protected 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");
|
||||
}
|
||||
|
||||
return this.ce_chemin;
|
||||
}
|
||||
}
|
119
Lecture.java
Normal file
119
Lecture.java
Normal file
@ -0,0 +1,119 @@
|
||||
import java.io.InputStream;
|
||||
import java.io.*;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Lecture {
|
||||
private String ce_chemin;
|
||||
private int data;
|
||||
|
||||
/* ===========================================================================================================================================================================
|
||||
*
|
||||
* CONSTRUCTEUR
|
||||
*
|
||||
* ===========================================================================================================================================================================
|
||||
*/
|
||||
|
||||
public Lecture(String un_chemin)
|
||||
{
|
||||
this.ce_chemin = un_chemin;
|
||||
}
|
||||
|
||||
/* ===========================================================================================================================================================================
|
||||
*
|
||||
* GET_HEADER
|
||||
*
|
||||
* ===========================================================================================================================================================================
|
||||
*/
|
||||
|
||||
protected int GetHeader(int n){
|
||||
try {
|
||||
/* Ouverture du flux */
|
||||
InputStream fis = new FileInputStream(this.ce_chemin);
|
||||
|
||||
for(int i=-1; i<n; i++){
|
||||
this.data = fis.read();
|
||||
}
|
||||
try{
|
||||
fis.close();
|
||||
}
|
||||
catch(IOException e){
|
||||
System.out.println("Erreur de fermeture");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return this.data;
|
||||
|
||||
} catch (IOException e) {
|
||||
System.err.println("Erreur relevé");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* ===========================================================================================================================================================================
|
||||
*
|
||||
* GET_OFFSET
|
||||
*
|
||||
* ===========================================================================================================================================================================
|
||||
*/
|
||||
|
||||
protected int[] GetOffset(){
|
||||
//Renvoie le paylodad. Dans notre cas tous les états de nos cases.
|
||||
// Renvoie le payload dans un tableau ou chaque elt du tableau en est un du payload.
|
||||
|
||||
try{
|
||||
/* Ouverture d'un flux */
|
||||
InputStream fis = new FileInputStream(this.ce_chemin);
|
||||
|
||||
int cette_taille=fis.available();/*cette_taille prend une aproximation de la taille du flux */
|
||||
|
||||
int ce_compteur = 0, temp;
|
||||
int [] ce_tableau = new int[cette_taille-4]; /*-5 pour le header mais +1 pour le -1 de fin de fichier. */
|
||||
int [] ce_tableau_temp = new int[8]; /*C'est le tab qui va stocker les différents octets */
|
||||
int[] ce_tab_to_return = new int[0];; /*Tableau qui va être renvoyé et qui va contenir tous les bits dans le non ordre */
|
||||
|
||||
/*On skip les 5 premiers octets */
|
||||
for(int i=0;i<5;i++){
|
||||
this.data = fis.read();
|
||||
}
|
||||
|
||||
/* ============================= Création tu tableau avec les différents octets en int ========================================== */
|
||||
|
||||
while(data != -1){
|
||||
this.data = fis.read();
|
||||
ce_tableau[ce_compteur]=this.data;
|
||||
ce_compteur=ce_compteur+1;
|
||||
}
|
||||
|
||||
/* =============================================================================================================================== */
|
||||
|
||||
//Utilisation du tableau différent pour créer un tableau avec tout les octets mais dans le bon sens grace a ma superbe classe Outils ;)
|
||||
|
||||
outils ToolBox = new outils();
|
||||
|
||||
for(int m=0; m<ce_tableau.length-1; m++){ //length -1 car on ne veux pas traiter le -1;
|
||||
temp = ce_tableau[m];
|
||||
|
||||
for(int n=0; n<8; n++){ //repetition 8 fois pour traiter les 8 bits
|
||||
ce_tableau_temp[n] = temp&1;
|
||||
temp = temp >> 1;
|
||||
}
|
||||
|
||||
ce_tab_to_return = ToolBox.concatenate(ce_tab_to_return, ToolBox.reverse(ce_tableau_temp));
|
||||
}
|
||||
|
||||
/* =================================================================================================================================== */
|
||||
|
||||
try{
|
||||
fis.close();
|
||||
} catch(IOException e){
|
||||
System.out.println("erreur lors de la fermeture");
|
||||
return null;
|
||||
}
|
||||
return ce_tab_to_return;
|
||||
}
|
||||
catch(IOException e){
|
||||
System.out.println("erreur d'ouverture");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
59
ModificationsFRG.java
Normal file
59
ModificationsFRG.java
Normal file
@ -0,0 +1,59 @@
|
||||
import java.awt.event.*;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class ModificationsFRG implements MouseListener {
|
||||
private int[] ce_tableau ;
|
||||
private OptionsFRG options;
|
||||
|
||||
public ModificationsFRG(OptionsFRG options, int[] un_tab){
|
||||
this.options = options;
|
||||
this.ce_tableau = un_tab;
|
||||
}
|
||||
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
JPanel notre_Panel = (JPanel) e.getSource();
|
||||
|
||||
Color test = notre_Panel.getBackground();
|
||||
|
||||
// Accéder aux boutons radios de l'objet Options
|
||||
boolean radio1Selected = options.GetButtonBW().isSelected();
|
||||
boolean radio2Selected = options.GetButtonE().isSelected();
|
||||
boolean radio3Selected = options.GetButtonS().isSelected();
|
||||
|
||||
if(test==Color.WHITE && radio1Selected==true){
|
||||
notre_Panel.setBackground(Color.BLACK);
|
||||
} else if(test==Color.BLACK && radio1Selected==true){
|
||||
notre_Panel.setBackground(Color.WHITE);
|
||||
}else if(radio1Selected==true && (test==Color.RED || test==Color.BLUE)){
|
||||
if(test==Color.BLUE){
|
||||
notre_Panel.setBackground(Color.WHITE);
|
||||
this.ce_tableau[0] = 0;
|
||||
} else if(test==Color.RED){
|
||||
notre_Panel.setBackground(Color.WHITE);
|
||||
this.ce_tableau[1] = 0;
|
||||
}
|
||||
} else if(test!=Color.BLUE && radio2Selected==true && this.ce_tableau[0]==0){
|
||||
notre_Panel.setBackground(Color.BLUE);
|
||||
this.ce_tableau[0]=1;
|
||||
} else if(test!=Color.RED && radio3Selected==true && this.ce_tableau[1]==0){
|
||||
this.ce_tableau[1]=1;
|
||||
notre_Panel.setBackground(Color.RED);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected int[] getValues(){
|
||||
return this.ce_tableau;
|
||||
}
|
||||
|
||||
public void mouseExited(MouseEvent e) {
|
||||
// Laisser cette méthode vide si vous n'avez pas besoin de l'utiliser
|
||||
}
|
||||
|
||||
// Les méthodes suivantes ne sont pas utilisées dans cet exemple, donc nous les laissons vides
|
||||
public void mouseReleased(MouseEvent e) {}
|
||||
public void mousePressed(MouseEvent e) {}
|
||||
public void mouseEntered(MouseEvent e) {}
|
||||
}
|
59
ModificationsFVG.java
Normal file
59
ModificationsFVG.java
Normal file
@ -0,0 +1,59 @@
|
||||
import java.awt.event.*;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class ModificationsFVG implements MouseListener {
|
||||
private int[] ce_tableau ;
|
||||
private OptionsFVG options;
|
||||
|
||||
public ModificationsFVG(OptionsFVG options, int[] un_tab){
|
||||
this.options = options;
|
||||
this.ce_tableau = un_tab;
|
||||
}
|
||||
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
JPanel notre_Panel = (JPanel) e.getSource();
|
||||
|
||||
Color test = notre_Panel.getBackground();
|
||||
|
||||
// Accéder aux boutons radios de l'objet Options
|
||||
boolean radio1Selected = options.GetButtonBW().isSelected();
|
||||
boolean radio2Selected = options.GetButtonE().isSelected();
|
||||
boolean radio3Selected = options.GetButtonS().isSelected();
|
||||
|
||||
if(test==Color.WHITE && radio1Selected==true){
|
||||
notre_Panel.setBackground(Color.BLACK);
|
||||
} else if(test==Color.BLACK && radio1Selected==true){
|
||||
notre_Panel.setBackground(Color.WHITE);
|
||||
}else if(radio1Selected==true && (test==Color.RED || test==Color.BLUE)){
|
||||
if(test==Color.BLUE){
|
||||
notre_Panel.setBackground(Color.WHITE);
|
||||
this.ce_tableau[0] = 0;
|
||||
} else if(test==Color.RED){
|
||||
notre_Panel.setBackground(Color.WHITE);
|
||||
this.ce_tableau[1] = 0;
|
||||
}
|
||||
} else if(test!=Color.BLUE && radio2Selected==true && this.ce_tableau[0]==0){
|
||||
notre_Panel.setBackground(Color.BLUE);
|
||||
this.ce_tableau[0]=1;
|
||||
} else if(test!=Color.RED && radio3Selected==true && this.ce_tableau[1]==0){
|
||||
this.ce_tableau[1]=1;
|
||||
notre_Panel.setBackground(Color.RED);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected int[] getValues(){
|
||||
return this.ce_tableau;
|
||||
}
|
||||
|
||||
public void mouseExited(MouseEvent e) {
|
||||
// Laisser cette méthode vide si vous n'avez pas besoin de l'utiliser
|
||||
}
|
||||
|
||||
// Les méthodes suivantes ne sont pas utilisées dans cet exemple, donc nous les laissons vides
|
||||
public void mouseReleased(MouseEvent e) {}
|
||||
public void mousePressed(MouseEvent e) {}
|
||||
public void mouseEntered(MouseEvent e) {}
|
||||
}
|
24
OptionsBoutonsFRG.java
Normal file
24
OptionsBoutonsFRG.java
Normal file
@ -0,0 +1,24 @@
|
||||
import java.awt.event.*;
|
||||
|
||||
public class OptionsBoutonsFRG implements ActionListener{
|
||||
private String Reponses1="Quitter", Reponses2="Sauvegarder";
|
||||
private String cet_event;
|
||||
private Exporter test;
|
||||
private FenetreRndmGrille ce_frg;
|
||||
|
||||
protected OptionsBoutonsFRG(FenetreRndmGrille un_frg){
|
||||
this.ce_frg = un_frg;
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent e){
|
||||
this.cet_event=e.getActionCommand();
|
||||
if (cet_event.equals(this.Reponses1)){
|
||||
System.exit(1);
|
||||
}
|
||||
else if (cet_event.equals(this.Reponses2)){
|
||||
System.out.println("Test1");
|
||||
this.test = new Exporter(this.ce_frg);
|
||||
this.test.jsp();
|
||||
}
|
||||
}
|
||||
}
|
19
OptionsBoutonsFVG.java
Normal file
19
OptionsBoutonsFVG.java
Normal file
@ -0,0 +1,19 @@
|
||||
import java.awt.event.*;
|
||||
|
||||
public class OptionsBoutonsFVG implements ActionListener{
|
||||
private String Reponses1="Quitter", Reponses2="Sauvegarder";
|
||||
private String cet_event;
|
||||
|
||||
protected OptionsBoutonsFVG(FenetreVideGrille FVG){
|
||||
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent e){
|
||||
this.cet_event=e.getActionCommand();
|
||||
if (cet_event.equals(this.Reponses1)){
|
||||
System.exit(1);
|
||||
}
|
||||
else if (cet_event.equals(this.Reponses2)){
|
||||
}
|
||||
}
|
||||
}
|
130
OptionsFRG.java
Normal file
130
OptionsFRG.java
Normal file
@ -0,0 +1,130 @@
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
|
||||
public class OptionsFRG extends Fenetre {
|
||||
public JRadioButton radio1;
|
||||
public JRadioButton radio2;
|
||||
public JRadioButton radio3;
|
||||
private FenetreRndmGrille ce_frg;
|
||||
|
||||
public OptionsFRG(FenetreRndmGrille un_frg){
|
||||
super();
|
||||
this.fenetre.setSize(400, 600);
|
||||
this.fenetre.setLocation(1100, 200);
|
||||
this.ce_frg = un_frg;
|
||||
}
|
||||
|
||||
protected void SetUp(){
|
||||
GridLayout gestionnaire = new GridLayout(4,1);
|
||||
this.fenetre.setLayout(gestionnaire);
|
||||
|
||||
/* Création du premier panneau */
|
||||
|
||||
JLabel un_d_text = new JLabel(" Etape 1 : création du labyrinthe");
|
||||
|
||||
JPanel un_Panel = new JPanel();
|
||||
un_Panel.setBackground(Color.CYAN);
|
||||
|
||||
un_Panel.add(un_d_text, BorderLayout.CENTER);
|
||||
|
||||
JPanel un_Panel2 = new JPanel();
|
||||
un_Panel2.setBackground(Color.CYAN);
|
||||
un_Panel2.setLayout(new BoxLayout(un_Panel2, BoxLayout.Y_AXIS));
|
||||
un_Panel2.add(Box.createVerticalGlue());
|
||||
un_Panel2.add(un_Panel);
|
||||
un_Panel2.add(Box.createVerticalGlue());
|
||||
|
||||
this.fenetre.add(un_Panel2, BorderLayout.CENTER);
|
||||
|
||||
/*Création du deuxième panneau */
|
||||
|
||||
JPanel un_Panel3 = new JPanel();
|
||||
JButton un_Button1 = new JButton("Sauvegarder");
|
||||
|
||||
JPanel un_Panel4 = new JPanel();
|
||||
un_Panel4.add(un_Button1);
|
||||
|
||||
un_Panel3.setBackground(Color.CYAN);
|
||||
un_Panel4.setBackground(Color.CYAN);
|
||||
|
||||
un_Panel3.setBackground(Color.CYAN);
|
||||
un_Panel3.setLayout(new BoxLayout(un_Panel3, BoxLayout.Y_AXIS));
|
||||
un_Panel3.add(Box.createVerticalGlue());
|
||||
un_Panel3.add(un_Panel4);
|
||||
un_Panel3.add(Box.createVerticalGlue());
|
||||
|
||||
this.fenetre.add(un_Panel3, BorderLayout.CENTER);
|
||||
|
||||
/* Nouveau panneau grille choix */
|
||||
|
||||
JPanel un_Panel10 = new JPanel();
|
||||
JPanel un_Panel11 = new JPanel();
|
||||
|
||||
radio1 = new JRadioButton("Construire ou Effacer");
|
||||
radio2 = new JRadioButton("Entrée");
|
||||
radio3 = new JRadioButton("Sortie");
|
||||
|
||||
radio1.setBackground(Color.CYAN);
|
||||
radio2.setBackground(Color.CYAN);
|
||||
radio3.setBackground(Color.CYAN);
|
||||
|
||||
radio1.setSelected(true);
|
||||
|
||||
ButtonGroup group = new ButtonGroup();
|
||||
group.add(radio1);group.add(radio2); group.add(radio3);
|
||||
|
||||
un_Panel11.add(radio1);
|
||||
un_Panel11.add(radio2);
|
||||
un_Panel11.add(radio3);
|
||||
|
||||
un_Panel10.setBackground(Color.CYAN);
|
||||
un_Panel10.setLayout(new BoxLayout(un_Panel10, BoxLayout.Y_AXIS));
|
||||
un_Panel10.add(Box.createVerticalGlue());
|
||||
un_Panel10.add(un_Panel11);
|
||||
un_Panel10.add(Box.createVerticalGlue());
|
||||
|
||||
|
||||
un_Panel10.setBackground(Color.CYAN);
|
||||
un_Panel11.setBackground(Color.CYAN);
|
||||
this.fenetre.add(un_Panel10, BorderLayout.CENTER);
|
||||
|
||||
/*Création du deuxième panneau */
|
||||
|
||||
JPanel un_Panel5 = new JPanel();
|
||||
JButton un_Button2 = new JButton("Quitter");
|
||||
|
||||
JPanel un_Panel6 = new JPanel();
|
||||
un_Panel6.add(un_Button2, BorderLayout.CENTER);
|
||||
|
||||
un_Panel5.setBackground(Color.CYAN);
|
||||
un_Panel6.setBackground(Color.CYAN);
|
||||
|
||||
un_Panel5.setBackground(Color.CYAN);
|
||||
un_Panel5.setLayout(new BoxLayout(un_Panel5, BoxLayout.Y_AXIS));
|
||||
un_Panel5.add(Box.createVerticalGlue());
|
||||
un_Panel5.add(un_Panel6);
|
||||
un_Panel5.add(Box.createVerticalGlue());
|
||||
|
||||
this.fenetre.add(un_Panel5, BorderLayout.CENTER);
|
||||
|
||||
/* */
|
||||
|
||||
OptionsBoutonsFRG hahaha = new OptionsBoutonsFRG(this.ce_frg);
|
||||
un_Button1.addActionListener(hahaha);
|
||||
un_Button2.addActionListener(hahaha);
|
||||
|
||||
/* Evenement */
|
||||
|
||||
this.fenetre.setVisible(true);
|
||||
}
|
||||
|
||||
protected JRadioButton GetButtonBW() {
|
||||
return radio1;
|
||||
}
|
||||
protected JRadioButton GetButtonE() {
|
||||
return radio2;
|
||||
}
|
||||
protected JRadioButton GetButtonS() {
|
||||
return radio3;
|
||||
}
|
||||
}
|
129
OptionsFVG.java
Normal file
129
OptionsFVG.java
Normal file
@ -0,0 +1,129 @@
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
|
||||
public class OptionsFVG extends Fenetre {
|
||||
public JRadioButton radio1;
|
||||
public JRadioButton radio2;
|
||||
public JRadioButton radio3;
|
||||
private FenetreVideGrille FVG;
|
||||
|
||||
public OptionsFVG(FenetreVideGrille FVG) {
|
||||
super();
|
||||
this.fenetre.setSize(400, 600);
|
||||
this.fenetre.setLocation(1100, 200);
|
||||
}
|
||||
|
||||
protected void set_up(){
|
||||
GridLayout gestionnaire = new GridLayout(4,1);
|
||||
this.fenetre.setLayout(gestionnaire);
|
||||
|
||||
/* Création du premier panneau */
|
||||
|
||||
JLabel un_d_text = new JLabel(" Etape 1 : création du labyrinthe");
|
||||
|
||||
JPanel un_Panel = new JPanel();
|
||||
un_Panel.setBackground(Color.CYAN);
|
||||
|
||||
un_Panel.add(un_d_text, BorderLayout.CENTER);
|
||||
|
||||
JPanel un_Panel2 = new JPanel();
|
||||
un_Panel2.setBackground(Color.CYAN);
|
||||
un_Panel2.setLayout(new BoxLayout(un_Panel2, BoxLayout.Y_AXIS));
|
||||
un_Panel2.add(Box.createVerticalGlue());
|
||||
un_Panel2.add(un_Panel);
|
||||
un_Panel2.add(Box.createVerticalGlue());
|
||||
|
||||
this.fenetre.add(un_Panel2, BorderLayout.CENTER);
|
||||
|
||||
/*Création du deuxième panneau */
|
||||
|
||||
JPanel un_Panel3 = new JPanel();
|
||||
JButton un_Button1 = new JButton("Sauvegrder");
|
||||
|
||||
JPanel un_Panel4 = new JPanel();
|
||||
un_Panel4.add(un_Button1);
|
||||
|
||||
un_Panel3.setBackground(Color.CYAN);
|
||||
un_Panel4.setBackground(Color.CYAN);
|
||||
|
||||
un_Panel3.setBackground(Color.CYAN);
|
||||
un_Panel3.setLayout(new BoxLayout(un_Panel3, BoxLayout.Y_AXIS));
|
||||
un_Panel3.add(Box.createVerticalGlue());
|
||||
un_Panel3.add(un_Panel4);
|
||||
un_Panel3.add(Box.createVerticalGlue());
|
||||
|
||||
this.fenetre.add(un_Panel3, BorderLayout.CENTER);
|
||||
|
||||
/* Nouveau panneau grille choix */
|
||||
|
||||
JPanel un_Panel10 = new JPanel();
|
||||
JPanel un_Panel11 = new JPanel();
|
||||
|
||||
radio1 = new JRadioButton("Mur et Couloir");
|
||||
radio2 = new JRadioButton("Entrée");
|
||||
radio3 = new JRadioButton("Sortie");
|
||||
|
||||
radio1.setBackground(Color.CYAN);
|
||||
radio2.setBackground(Color.CYAN);
|
||||
radio3.setBackground(Color.CYAN);
|
||||
|
||||
radio1.setSelected(true);
|
||||
|
||||
ButtonGroup group = new ButtonGroup();
|
||||
group.add(radio1);group.add(radio2); group.add(radio3);
|
||||
|
||||
un_Panel11.add(radio1);
|
||||
un_Panel11.add(radio2);
|
||||
un_Panel11.add(radio3);
|
||||
|
||||
un_Panel10.setBackground(Color.CYAN);
|
||||
un_Panel10.setLayout(new BoxLayout(un_Panel10, BoxLayout.Y_AXIS));
|
||||
un_Panel10.add(Box.createVerticalGlue());
|
||||
un_Panel10.add(un_Panel11);
|
||||
un_Panel10.add(Box.createVerticalGlue());
|
||||
|
||||
|
||||
un_Panel10.setBackground(Color.CYAN);
|
||||
un_Panel11.setBackground(Color.CYAN);
|
||||
this.fenetre.add(un_Panel10, BorderLayout.CENTER);
|
||||
|
||||
/*Création du deuxième panneau */
|
||||
|
||||
JPanel un_Panel5 = new JPanel();
|
||||
JButton un_Button2 = new JButton("Quitter");
|
||||
|
||||
JPanel un_Panel6 = new JPanel();
|
||||
un_Panel6.add(un_Button2, BorderLayout.CENTER);
|
||||
|
||||
un_Panel5.setBackground(Color.CYAN);
|
||||
un_Panel6.setBackground(Color.CYAN);
|
||||
|
||||
un_Panel5.setBackground(Color.CYAN);
|
||||
un_Panel5.setLayout(new BoxLayout(un_Panel5, BoxLayout.Y_AXIS));
|
||||
un_Panel5.add(Box.createVerticalGlue());
|
||||
un_Panel5.add(un_Panel6);
|
||||
un_Panel5.add(Box.createVerticalGlue());
|
||||
|
||||
this.fenetre.add(un_Panel5, BorderLayout.CENTER);
|
||||
|
||||
/* */
|
||||
|
||||
OptionsBoutonsFVG hahaha = new OptionsBoutonsFVG(this.FVG);
|
||||
un_Button1.addActionListener(hahaha);
|
||||
un_Button2.addActionListener(hahaha);
|
||||
|
||||
/* Evenement */
|
||||
|
||||
this.fenetre.setVisible(true);
|
||||
}
|
||||
|
||||
protected JRadioButton GetButtonBW() {
|
||||
return radio1;
|
||||
}
|
||||
protected JRadioButton GetButtonE() {
|
||||
return radio2;
|
||||
}
|
||||
protected JRadioButton GetButtonS() {
|
||||
return radio3;
|
||||
}
|
||||
}
|
6
Start.java
Normal file
6
Start.java
Normal file
@ -0,0 +1,6 @@
|
||||
public class Start {
|
||||
public static void main(String[] args) {
|
||||
FenetreInit une_fenetre = new FenetreInit();
|
||||
une_fenetre.Initialisation();
|
||||
}
|
||||
}
|
19
azert.java
Normal file
19
azert.java
Normal file
@ -0,0 +1,19 @@
|
||||
public class azert {
|
||||
public static void main(String[] Args){
|
||||
int i = 6, j, compteur=0;
|
||||
int[] tab = new int[8];
|
||||
int[] copie = new int[8];
|
||||
for(j=0; j<8; j++){
|
||||
tab[j] = i&1;
|
||||
i = i >> 1;
|
||||
/*System.out.println(j+" bits reverse = "+tab[j]);*/
|
||||
}
|
||||
for(j=7; j>0; j--){
|
||||
copie[j]=tab[compteur];
|
||||
compteur++;
|
||||
}
|
||||
for(j=0; j<8; j++){
|
||||
System.out.println(j+" bits reverse = "+copie[j]);
|
||||
}
|
||||
}
|
||||
}
|
21
creer.java
Normal file
21
creer.java
Normal file
@ -0,0 +1,21 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
public class creer implements ActionListener {
|
||||
private String cet_event, f_option = "Nouvelle Grille";
|
||||
private JFrame cette_frame;
|
||||
|
||||
public creer(JFrame frame_initial){
|
||||
super();
|
||||
this.cette_frame=frame_initial;
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent e){
|
||||
this.cet_event=e.getActionCommand();
|
||||
this.cette_frame.dispose();
|
||||
if (cet_event.equals(f_option)){
|
||||
FenetreDefSize hehe = new FenetreDefSize();
|
||||
hehe.MiseEnPlace();
|
||||
}
|
||||
}
|
||||
}
|
46
importer.java
Normal file
46
importer.java
Normal file
@ -0,0 +1,46 @@
|
||||
import java.awt.event.*;
|
||||
import javax.swing.JFrame;
|
||||
|
||||
public class importer implements ActionListener {
|
||||
String cette_option;
|
||||
String cet_event;
|
||||
String ce_chemin;
|
||||
JFrame cette_frame;
|
||||
Lecture cette_lecture;
|
||||
FenetreImpGrille cette_fenetre;
|
||||
int valeur0, valeur1, valeur2, valeur3, valeur4;
|
||||
|
||||
|
||||
public importer(JFrame une_frame){
|
||||
this.cette_option="Importer Grille";
|
||||
this.cette_frame = une_frame;
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent e){
|
||||
this.cet_event=e.getActionCommand();
|
||||
if(cet_event.equals(this.cette_option)){
|
||||
System.out.println("Importation de la grille");
|
||||
|
||||
/*cherche le chemin du fichier */
|
||||
FileImport un_test = new FileImport();
|
||||
this.ce_chemin = un_test.Parcours();
|
||||
|
||||
/*lecture du fichier */
|
||||
this.cette_lecture = new Lecture(this.ce_chemin);
|
||||
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);
|
||||
|
||||
/*Fermeture de la première fenètre */
|
||||
cette_frame.dispose();
|
||||
|
||||
/* Ouverture de la nouvelle */
|
||||
|
||||
this.cette_fenetre = new FenetreImpGrille();
|
||||
|
||||
cette_fenetre.ImporterGrille(this.valeur0, this.valeur1, this.valeur2, this.valeur3, this.valeur4, this.cette_lecture.GetOffset());
|
||||
}
|
||||
}
|
||||
}
|
43
outils.java
Normal file
43
outils.java
Normal file
@ -0,0 +1,43 @@
|
||||
public class outils {
|
||||
protected outils(){
|
||||
}
|
||||
|
||||
public int[] reverse(int[] un_tableau) {
|
||||
int taille = un_tableau.length;
|
||||
|
||||
int[] cette_copie;
|
||||
cette_copie = new int[un_tableau.length];
|
||||
int compteur=taille;
|
||||
|
||||
for(int j=0; j<cette_copie.length; j++){
|
||||
cette_copie[j]=un_tableau[compteur-1];
|
||||
compteur--;
|
||||
}
|
||||
|
||||
return cette_copie;
|
||||
}
|
||||
|
||||
public int[] concatenate(int[] first_tab, int[] tab_to_add){
|
||||
int taille = first_tab.length;
|
||||
|
||||
int[] tableau_temp = new int[taille+tab_to_add.length];
|
||||
int compteur = 0;
|
||||
|
||||
if(first_tab != null){
|
||||
for(int i=0;i<taille;i++){
|
||||
tableau_temp[compteur]=first_tab[i];
|
||||
compteur++;
|
||||
}
|
||||
}
|
||||
|
||||
if(tab_to_add != null){
|
||||
for(int i=0;i<tab_to_add.length;i++){
|
||||
tableau_temp[compteur]=tab_to_add[i];
|
||||
compteur++;
|
||||
}
|
||||
}
|
||||
|
||||
return tableau_temp;
|
||||
|
||||
}
|
||||
}
|
30
taille_su.java
Normal file
30
taille_su.java
Normal file
@ -0,0 +1,30 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
public class taille_su extends JFrame implements ActionListener {
|
||||
private JFrame cette_frame;
|
||||
private JTextField ce_tfield;
|
||||
private ButtonGroup ce_group;
|
||||
|
||||
public taille_su(JFrame une_frame, JTextField un_tfield, ButtonGroup group){
|
||||
this.cette_frame = une_frame;
|
||||
this.ce_tfield = un_tfield;
|
||||
this.ce_group = group;
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent e){
|
||||
this.cette_frame.dispose();
|
||||
|
||||
String valleur_taille = this.ce_tfield.getText();
|
||||
|
||||
if(this.ce_group.getSelection().getActionCommand()=="Grille randomisée"){
|
||||
FenetreRndmGrille cette_fenetre = new FenetreRndmGrille(Integer.parseInt(valleur_taille));
|
||||
cette_fenetre.RandomGrille();
|
||||
}
|
||||
|
||||
else if(this.ce_group.getSelection().getActionCommand()=="Grille vide"){
|
||||
FenetreVideGrille cette_fenetre = new FenetreVideGrille();
|
||||
cette_fenetre.create_empty(Integer.parseInt(valleur_taille));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user