63 lines
1.9 KiB
Java
63 lines
1.9 KiB
Java
import java.awt.*;
|
|
import javax.swing.*;
|
|
import javax.swing.border.Border;
|
|
|
|
public class FenetreVideGrille extends Fenetre{
|
|
private int[] tab_de_int;
|
|
private int Taille;
|
|
private int ValeurEntre;
|
|
private int ValeurSortie;
|
|
|
|
private JPanel[][] TabDePanel;
|
|
|
|
public FenetreVideGrille(int Taille){
|
|
super();
|
|
this.tab_de_int = new int[] {0, 0};
|
|
this.Taille = Taille;
|
|
this.TabDePanel = new JPanel[this.Taille][this.Taille];
|
|
}
|
|
|
|
protected void CreerVide(){
|
|
this.fenetre.setSize(600, 600);
|
|
this.fenetre.setLocation(450, 200);
|
|
|
|
OptionsFVG un_Test = new OptionsFVG(this);
|
|
un_Test.SetUp();
|
|
|
|
GridLayout gestionnaire = new GridLayout(Taille,Taille);
|
|
this.fenetre.setLayout(gestionnaire);
|
|
|
|
for(int i=0; i<this.Taille; i++){
|
|
for(int j=0; j<this.Taille; j++){
|
|
|
|
JPanel ce_panel = new JPanel();
|
|
this.TabDePanel[j][i] = ce_panel;
|
|
|
|
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);
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|