SAE21_2022/FenetreInit.java

58 lines
1.7 KiB
Java
Raw Normal View History

import javax.swing.*;
import java.awt.*;
public class FenetreInit extends Fenetre
{
public FenetreInit(){
super();
}
public 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);
}
}