From e22ee6451317fc41253a42d8752d13debebadcc8 Mon Sep 17 00:00:00 2001 From: besson Date: Thu, 1 Dec 2022 11:58:21 +0100 Subject: [PATCH] =?UTF-8?q?Transf=C3=A9rer=20les=20fichiers=20vers=20'src/?= =?UTF-8?q?Test'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Test/AdminView.java | 16 ++++------------ src/Test/BDatabase.java | 2 +- src/Test/Controller.java | 30 ++++++++++++++++++++---------- src/Test/MainMenu.java | 35 +++++++++++++++++++++++++++++++---- src/Test/ProfView.java | 17 +++++------------ 5 files changed, 61 insertions(+), 39 deletions(-) diff --git a/src/Test/AdminView.java b/src/Test/AdminView.java index 4771b81..58d5a61 100644 --- a/src/Test/AdminView.java +++ b/src/Test/AdminView.java @@ -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 e; private final ArrayList g; private final Controller listener; public AdminView(ArrayList e, ArrayList 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(); } } diff --git a/src/Test/BDatabase.java b/src/Test/BDatabase.java index 2d8d63e..cb097aa 100644 --- a/src/Test/BDatabase.java +++ b/src/Test/BDatabase.java @@ -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"); diff --git a/src/Test/Controller.java b/src/Test/Controller.java index ba86ffe..bb42cd9 100644 --- a/src/Test/Controller.java +++ b/src/Test/Controller.java @@ -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; } } -} \ No newline at end of file + + + public void setPv (ProfView pv) { + if (this.pv == null) { + this.pv = pv; + } + } + + + public ArrayList getEtudiants () { + return this.e; + } + + + public ArrayList getGroupes() { + return this.g; + } +} diff --git a/src/Test/MainMenu.java b/src/Test/MainMenu.java index 948c378..48f0e2f 100644 --- a/src/Test/MainMenu.java +++ b/src/Test/MainMenu.java @@ -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(); diff --git a/src/Test/ProfView.java b/src/Test/ProfView.java index 288d734..2d8118a 100644 --- a/src/Test/ProfView.java +++ b/src/Test/ProfView.java @@ -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 e; private final ArrayList g; private final Controller listener; @@ -21,14 +23,7 @@ public class ProfView extends BFrame { private JTextField text; public ProfView(ArrayList e, ArrayList 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(); } }