This commit is contained in:
pro.boooooo 2022-11-26 22:30:18 +01:00
parent f9fb42c899
commit 7d122608b3
7 changed files with 48 additions and 6 deletions

View File

@ -4,6 +4,7 @@ import API.Etudiant;
import API.Groupe;
import java.util.ArrayList;
import javax.swing.JButton;
import javax.swing.JLabel;
public class AdminView extends BFrame {
private final ArrayList<Etudiant> e;
@ -32,10 +33,19 @@ public class AdminView extends BFrame {
settings.setPositionX(0);
settings.setPositionY(0);
JButton moveStud = new JButton("Deplacer un etudiant");
moveStud.addActionListener(this.listener);
moveStud.setActionCommand("av::MoveStudent");
this.add(moveStud, settings);
JButton moveStudGrup = new JButton("Changer le groupe d'un etudiant");
moveStudGrup.addActionListener(this.listener);
moveStudGrup.setActionCommand("av::MoveStudGrup");
this.add(moveStudGrup, settings);
settings.setPositionY(1);
this.add(new JLabel(" "), settings);
settings.setPositionY(2);
JButton addStudGrup = new JButton("Ajouter un etudiant dans un groupe");
addStudGrup.addActionListener(this.listener);
addStudGrup.setActionCommand("av::AddStudGrup");
this.add(addStudGrup, settings);
this.openBFrame();
this.refreshBFrame();

View File

@ -172,8 +172,40 @@ public class Controller implements ActionListener {
}
}
else if(Objects.equals(command, "av::MoveStudent")) {
else if(Objects.equals(command, "av::MoveStudGrup")) {
BFrame frame = new BFrame(
"Deplacer un etudiant",
1,
1,
500,
500,
"GridLayout",
1,
1,
2
);
String[][] data = new String[this.e.size()][3];
Object[] titre = {
(String) "Nom",
(String) "Prenom",
(String) "Groupe",
(String) "Action"
};
for(int i = 0; i <= this.e.size()-1; i++) {
Object[] info = {
(String) this.e.get(i).getNom(),
(String) this.e.get(i).getPrenom(),
(String) String.valueOf(this.e.get(i).getGroupe()),
(String) "Deplacer"
};
data[i] = info;
}
Display(frame, data, titre);
}
}
@ -183,7 +215,7 @@ public class Controller implements ActionListener {
* @param data Les donnees des colonnes du tableau
* @param titre Les titres des colonnes
* */
private void Display(BFrame frame, String[][] data, String[] titre) {
private void Display(BFrame frame, Object[][] data, Object[] titre) {
JTable liste = new JTable(data, titre) {
public boolean editCellAt(int row, int column, java.util.EventObject e) {
return false;