debut MPD
This commit is contained in:
@@ -1,42 +0,0 @@
|
||||
package fr.iutfbleau.projetIHM2022FI2.Graphic.View;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.GridBagConstraints;
|
||||
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Groupe;
|
||||
import fr.iutfbleau.projetIHM2022FI2.Graphic.Controller.ObservateurFenetre;
|
||||
|
||||
public class MaFenetre extends JFrame{
|
||||
private JPanel Left;
|
||||
private JPanel Right;
|
||||
private PaintGroupe paint;
|
||||
|
||||
public MaFenetre(){
|
||||
super();
|
||||
this.setSize(1000,720);
|
||||
this.setLocation(200,200);
|
||||
this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
||||
this.addWindowListener(new ObservateurFenetre());
|
||||
this.setLayout(new GridLayout(1,2));
|
||||
|
||||
this.Left=new JPanel(new GridLayout(2,1));
|
||||
this.Right=new JPanel();
|
||||
|
||||
this.paint=new PaintGroupe();
|
||||
|
||||
this.Left.setBackground(Color.RED);
|
||||
this.Left.add(this.paint);
|
||||
this.add(this.Left);
|
||||
|
||||
this.Right.setBackground(Color.BLUE);
|
||||
this.add(this.Right);
|
||||
}
|
||||
|
||||
public void addGroupe(Groupe g){
|
||||
this.paint.addGroupe(g);
|
||||
}
|
||||
}
|
@@ -26,10 +26,11 @@ public class PaintGroupe extends JComponent {
|
||||
int y=100;
|
||||
for(Groupe g: this.tabGroupe){
|
||||
secondPinceau.setColor(Color.BLACK);
|
||||
secondPinceau.setFont(new Font(Font.SANS_SERIF, Font.BOLD, this.getWidth()/10));
|
||||
secondPinceau.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 40));
|
||||
FontMetrics metrics = secondPinceau.getFontMetrics(secondPinceau.getFont());
|
||||
secondPinceau.drawString(g.getName().toUpperCase(), (this.getWidth()/2-metrics.stringWidth(g.getName().toUpperCase())/2), (y-metrics.getAscent()));
|
||||
g.getName();
|
||||
y+=100;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user