Ajout chargement pour faire styler

This commit is contained in:
2022-11-13 15:46:15 +01:00
parent c06ff537ad
commit e9fac29412
5 changed files with 123 additions and 35 deletions

View File

@@ -0,0 +1,42 @@
package fr.iutfbleau.projetIHM2022FI2.Graphic.View;
import java.awt.Graphics;
import javax.swing.JComponent;
import java.awt.*;
/**
* Class Dessinant les boutons du menu
*/
public class Chargement extends JComponent{
private int pourcentage;
public Chargement(){
this.pourcentage=0;
}
public void addPourcent(int n){
this.pourcentage+=n;
this.repaint();
}
@Override
protected void paintComponent(Graphics pinceau) {
// obligatoire : on crée un nouveau pinceau pour pouvoir le modifier plus tard
Graphics2D secondPinceau = (Graphics2D) pinceau.create();
secondPinceau.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
// obligatoire : si le composant n'est pas censé être transparent
if (this.isOpaque()) {
// obligatoire : on repeint toute la surface avec la couleur de fond
secondPinceau.setColor(this.getBackground());
secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight());
}
// maintenant on dessine ce que l'on veut
secondPinceau.setColor(Color.BLUE);
secondPinceau.setFont(new Font(Font.SANS_SERIF, Font.BOLD, (this.getWidth()/10)));
FontMetrics metrics = secondPinceau.getFontMetrics(secondPinceau.getFont());
secondPinceau.drawString("CHARGEMENT", (this.getWidth()/2-metrics.stringWidth("CHARGEMENT")/2), (this.getHeight()-metrics.getHeight())/3+metrics.getAscent());
secondPinceau.drawRect(this.getWidth()/10, this.getHeight()/2, this.getWidth()/10*8, this.getHeight()/10);
secondPinceau.fillRect(this.getWidth()/10, this.getHeight()/2, this.getWidth()/10*8/100*pourcentage, this.getHeight()/10);
}
}

View File

@@ -14,10 +14,15 @@ import fr.iutfbleau.projetIHM2022FI2.API.Groupe;
public class FenetreEtudiant extends JPanel{
private Set<Etudiant> etu;
public FenetreEtudiant(Groupe g){
super(new GridLayout(57, 1));
this.etu=g.getEtudiants();
for(Etudiant e: this.etu){
this.add(new JLabel(e.monPrint()));
super();
if(g!=null){
this.setLayout(new GridLayout(57, 1));
this.etu=g.getEtudiants();
for(Etudiant e: this.etu){
this.add(new JLabel(e.monPrint()));
}
}else{
this.add(new JLabel("Il n'y a pas d'étudiant"));
}
}
}

View File

@@ -13,20 +13,25 @@ import fr.iutfbleau.projetIHM2022FI2.Graphic.Controller.ObservateurChangeGroupe;
public class FenetreGroupe extends JPanel{
private Groupe g;
public FenetreGroupe(Groupe g, Model m){
super(new GridLayout(15, 1));
super();
this.g=g;
JButton bout=new JButton("point point");
bout.addActionListener(new ObservateurChangeGroupe(m, this.g.getPointPoint()));
this.add(bout);
this.add(new JLabel(g.getName()));
this.add(new JLabel("id= "+String.valueOf(g.getId())));
this.add(new JLabel("min= "+String.valueOf(g.getMin())));
this.add(new JLabel("max= "+String.valueOf(g.getMax())));
this.add(new JLabel("Sous groupe"));
for(Groupe gr: g.getSousGroupes()){
JButton b=new JButton(gr.getName());
b.addActionListener(new ObservateurChangeGroupe(m, gr));
this.add(b);
if(g!=null){
this.setLayout(new GridLayout(15, 1));
JButton bout=new JButton("point point");
bout.addActionListener(new ObservateurChangeGroupe(m, this.g.getPointPoint()));
this.add(bout);
this.add(new JLabel(g.getName()));
this.add(new JLabel("id= "+String.valueOf(g.getId())));
this.add(new JLabel("min= "+String.valueOf(g.getMin())));
this.add(new JLabel("max= "+String.valueOf(g.getMax())));
this.add(new JLabel("Sous groupe"));
for(Groupe gr: g.getSousGroupes()){
JButton b=new JButton(gr.getName());
b.addActionListener(new ObservateurChangeGroupe(m, gr));
this.add(b);
}
}else{
this.add(new JLabel("Il n'y a pas encore de Groupe"));
}
}
}