Transférer les fichiers vers 'src/Test'

This commit is contained in:
Romain BESSON 2022-12-01 11:58:21 +01:00
parent 1430f84f21
commit e22ee64513
5 changed files with 61 additions and 39 deletions

View File

@ -5,21 +5,15 @@ import API.Groupe;
import java.util.ArrayList;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class AdminView extends BFrame {
public class AdminView extends JPanel {
private final ArrayList<Etudiant> e;
private final ArrayList<Groupe> g;
private final Controller listener;
public AdminView(ArrayList<Etudiant> e, ArrayList<Groupe> g, Controller listener) {
super(
"Vue Administrateur",
150,
300,
500,
500,
3
);
super();
this.listener = listener;
this.g = g;
@ -47,8 +41,6 @@ public class AdminView extends BFrame {
addStudGrup.setActionCommand("av::AddStudGrup");
this.add(addStudGrup, settings);
this.setResizable(false);
this.openBFrame();
this.refreshBFrame();
this.repaint();
}
}

View File

@ -34,7 +34,7 @@ public class BDatabase {
this.db_host = "jdbc:mariadb://dwarves.iut-fbleau.fr/";
this.db_name = "brinet";
this.db_user = "brinet";
this.db_password = "Aignan41!";
this.db_password = "BIFERO77BuT+";
try {
Class.forName("org.mariadb.jdbc.Driver");

View File

@ -440,16 +440,26 @@ public class Controller implements ActionListener, ListSelectionListener {
}
public void createProfView () {
if (this.pv == null) {
this.pv = new ProfView(this.e, this.g, this);
}
}
public void createAdminView () {
public void setAv (AdminView av) {
if (this.av == null) {
this.av = new AdminView(this.e, this.g, this);
this.av = av;
}
}
}
public void setPv (ProfView pv) {
if (this.pv == null) {
this.pv = pv;
}
}
public ArrayList<Etudiant> getEtudiants () {
return this.e;
}
public ArrayList<Groupe> getGroupes() {
return this.g;
}
}

View File

@ -5,7 +5,12 @@ import java.awt.*;
import java.awt.event.ActionEvent;
public class MainMenu extends JFrame {
private final static Dimension MINIMUM_SIZE = new Dimension(960, 540);
private CardLayout cards = new CardLayout();
private AdminView av;
private ProfView pv;
private JButton[] buttonTab = {
new JButton("Admin"),
new JButton("Prof"),
@ -17,11 +22,23 @@ public class MainMenu extends JFrame {
super();
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setExtendedState(MAXIMIZED_BOTH);
//this.setUndecorated(true);
this.setMinimumSize(MINIMUM_SIZE);
init();
this.setVisible(true);
}
private void init() {
BDatabase db = new BDatabase();
Controller listener = new Controller(db);
av = new AdminView(listener.getEtudiants(), listener.getGroupes(), listener);
pv = new ProfView(listener.getEtudiants(), listener.getGroupes(), listener);
this.setLayout(cards);
this.add(first());
this.add(adminView());
this.add(profView());
cards.first(this.getContentPane());
this.setVisible(true);
}
@ -51,11 +68,21 @@ public class MainMenu extends JFrame {
}
private JPanel adminView() {
JPanel mainPanel = new JPanel
}
private JPanel profView() {
}
private void action(ActionEvent e) {
JButton origin = (JButton) e.getSource();
System.out.println(origin.getText());
BDatabase db = new BDatabase();
Controller listener = new Controller(db);
if (origin.getText() == "Admin") {
listener.createAdminView();

View File

@ -6,6 +6,8 @@ import javax.swing.JComboBox;
import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.GridBagConstraints;
@ -13,7 +15,7 @@ import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
public class ProfView extends BFrame {
public class ProfView extends JPanel {
private final ArrayList<Etudiant> e;
private final ArrayList<Groupe> g;
private final Controller listener;
@ -21,14 +23,7 @@ public class ProfView extends BFrame {
private JTextField text;
public ProfView(ArrayList<Etudiant> e, ArrayList<Groupe> g, Controller listener) {
super(
"Vue Professeur",
700,
300,
500,
500,
3
);
super();
this.listener = listener;
this.e = e;
@ -116,8 +111,6 @@ public class ProfView extends BFrame {
searchTLetters.setActionCommand("pv::SearchStudentPer3Letters");
this.add(searchTLetters, settings);
this.setResizable(false);
this.openBFrame();
this.refreshBFrame();
this.repaint();
}
}