This commit is contained in:
2022-10-31 15:02:52 +01:00
parent c6af915993
commit bca98479f6
36 changed files with 7637 additions and 4 deletions

View File

@@ -0,0 +1,57 @@
package fr.iutfbleau.projetIHM2022FI2.Graphic.Controller;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import javax.swing.JOptionPane;
import javax.swing.JFrame;
public class ObservateurFenetre implements WindowListener{
public ObservateurFenetre(){
}
@Override
public void windowActivated(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowClosed(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowClosing(WindowEvent e) {
JFrame fenetre= (JFrame) e.getSource();
int confirmation = JOptionPane.showConfirmDialog(fenetre.getContentPane(), "Etes-vous sûr de vouloir fermer la fenetre ?", "Quitter", JOptionPane.YES_NO_OPTION);
if(confirmation != JOptionPane.OK_OPTION) return;
fenetre.dispose();
}
@Override
public void windowDeactivated(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowDeiconified(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowIconified(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowOpened(WindowEvent e) {
// TODO Auto-generated method stub
}
}

View File

@@ -0,0 +1,75 @@
package fr.iutfbleau.projetIHM2022FI2.Graphic.View;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.*;
import java.util.LinkedList;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import fr.iutfbleau.projetIHM2022FI2.API.*;
import fr.iutfbleau.projetIHM2022FI2.Graphic.Controller.ObservateurFenetre;
public class MaFenetre extends JFrame{
private LinkedList<Groupe> tabGroupe=new LinkedList<Groupe>();
private JPanel Left;
private JPanel Right;
public MaFenetre(){
super();
this.setSize(1000,720);
this.setLocation(200,200);
this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
this.getContentPane().setBackground(new Color(230, 230, 255, 255));
this.addWindowListener(new ObservateurFenetre());
this.setLayout(new GridBagLayout());
this.Left=new JPanel();
this.Right=new JPanel();
GridBagConstraints gc=new GridBagConstraints();
gc.gridx=1;
gc.gridy=1;
gc.anchor=GridBagConstraints.CENTER;
gc.gridheight=1;
gc.gridwidth=1;
gc.fill=GridBagConstraints.BOTH;
this.add(this.Left, gc);
gc.gridx=2;
gc.gridy=1;
gc.anchor=GridBagConstraints.CENTER;
gc.gridheight=1;
gc.gridwidth=1;
gc.fill=GridBagConstraints.BOTH;
this.add(this.Right, gc);
}
public void addGroupe(Groupe g){
this.tabGroupe.add(g);
}
public boolean removeGroupe(Groupe g){
int i=this.tabGroupe.indexOf(g);
if(i==-1){
return false;
}else{
this.tabGroupe.remove(i);
}
return true;
}
private void GroupeDraw(){
}
private GridBagConstraints getConstraints(int index){
GridBagConstraints gc=new GridBagConstraints();
gc.gridx=1;
gc.gridy=index;
gc.anchor=GridBagConstraints.BASELINE;
gc.gridheight=1;
gc.gridwidth=1;
gc.insets=null;
gc.fill=GridBagConstraints.HORIZONTAL;
return gc;
}
}

View File

@@ -1,13 +1,15 @@
package fr.iutfbleau.projetIHM2022FI2.Test;
import fr.iutfbleau.projetIHM2022FI2.API.*;
import fr.iutfbleau.projetIHM2022FI2.Graphic.View.*;
import fr.iutfbleau.projetIHM2022FI2.Graphic.View.MaFenetre;
import fr.iutfbleau.projetIHM2022FI2.MNP.*;
import java.util.*;
//import java.util.Random;
public class TestTexteMNP{
public static void main(String[] args) {
// morceaux de modèle
// Notez que à gauche d'une déclaration on utilise une interface et à droite une version concrète.
@@ -17,7 +19,8 @@ public class TestTexteMNP{
System.out.println("Test de l\'API");
System.out.print("Création des étudiants");
MaFenetre fenetre=new MaFenetre();
fenetre.setVisible(true);
Etudiant e1=new EtudiantNP("césar","lycurgus");
Etudiant e2=new EtudiantNP("denis","uranus");
Etudiant e3=new EtudiantNP("marcel","castor");