2023-04-18 12:29:43 +02:00
|
|
|
import java.awt.*;
|
|
|
|
import javax.swing.*;
|
|
|
|
import javax.swing.border.Border;
|
|
|
|
|
|
|
|
public class FenetreVideGrille extends Fenetre{
|
|
|
|
private int[] tab_de_int;
|
2023-04-18 18:38:32 +02:00
|
|
|
private int Taille;
|
|
|
|
private int ValeurEntre;
|
|
|
|
private int ValeurSortie;
|
2023-04-18 12:29:43 +02:00
|
|
|
|
2023-04-18 18:38:32 +02:00
|
|
|
private JPanel[][] TabDePanel;
|
|
|
|
|
|
|
|
public FenetreVideGrille(int Taille){
|
2023-04-18 12:29:43 +02:00
|
|
|
super();
|
|
|
|
this.tab_de_int = new int[] {0, 0};
|
2023-04-18 18:38:32 +02:00
|
|
|
this.Taille = Taille;
|
|
|
|
this.TabDePanel = new JPanel[this.Taille][this.Taille];
|
2023-04-18 12:29:43 +02:00
|
|
|
}
|
|
|
|
|
2023-04-19 19:13:00 +02:00
|
|
|
public void CreerVide(){
|
2023-04-18 12:29:43 +02:00
|
|
|
this.fenetre.setSize(600, 600);
|
|
|
|
this.fenetre.setLocation(450, 200);
|
|
|
|
|
|
|
|
OptionsFVG un_Test = new OptionsFVG(this);
|
2023-04-18 18:38:32 +02:00
|
|
|
un_Test.SetUp();
|
2023-04-18 12:29:43 +02:00
|
|
|
|
|
|
|
GridLayout gestionnaire = new GridLayout(Taille,Taille);
|
|
|
|
this.fenetre.setLayout(gestionnaire);
|
|
|
|
|
2023-04-18 18:38:32 +02:00
|
|
|
for(int i=0; i<this.Taille; i++){
|
|
|
|
for(int j=0; j<this.Taille; j++){
|
|
|
|
|
2023-04-18 12:29:43 +02:00
|
|
|
JPanel ce_panel = new JPanel();
|
2023-04-18 18:38:32 +02:00
|
|
|
this.TabDePanel[j][i] = ce_panel;
|
|
|
|
|
2023-04-18 12:29:43 +02:00
|
|
|
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);
|
|
|
|
}
|
2023-04-18 18:38:32 +02:00
|
|
|
|
2023-04-19 19:13:00 +02:00
|
|
|
public int[] get_info(){
|
2023-04-18 18:38:32 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2023-04-19 19:13:00 +02:00
|
|
|
public JPanel[][] getGrille(){
|
2023-04-18 18:38:32 +02:00
|
|
|
return this.TabDePanel;
|
|
|
|
}
|
2023-04-18 12:29:43 +02:00
|
|
|
}
|