Skip to content

Commit

Permalink
finished formation, and made the ajout etudiant interface 1st version
Browse files Browse the repository at this point in the history
  • Loading branch information
saaya-code committed Mar 24, 2024
1 parent 16fa81d commit 466a562
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/ExercicesTP/CRUD/EtudiantDAO.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package ExercicesTP.CRUD;
import ExercicesTP.Etudiant;
import ExercicesTP.interfaces.EtudiantDaoCRUD;
public class EtudiantDAO implements EtudiantDaoCRUD{

@Override
public void addEtudiant(Etudiant etudiant) {

}

@Override
public void deleteEtudiant(int id) {

}

@Override
public void updateEtudiant(Etudiant etudiant) {

}

@Override
public Etudiant getEtudiant(int id) {
return null;
}

@Override
public Etudiant[] getAllEtudiants() {
return new Etudiant[0];
}
}
72 changes: 72 additions & 0 deletions src/ExercicesTP/IHM/IHMAjoutEtudiant.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package ExercicesTP.IHM;
import javax.swing.*;
import java.awt.*;

public class IHMAjoutEtudiant extends JInternalFrame{
public JLabel nomLabel, prenomLabel, numEtdLabel, filiereLabel, niveauLabel, groupeLabel;
public JTextField nomField, prenomField, numEtdField;
public JComboBox<String> filiereComboBox;
public JComboBox<Integer> niveauComboBox, groupeComboBox;

public JButton addButton, cancelButton;
public IHMAjoutEtudiant(){
setTitle("Ajout d'un étudiant");
setSize(400, 400);
initializeComponents();
createLayout();
//addEventListeners();
setVisible(true);
}
private void addComponent(JPanel panel, JComponent component, GridBagConstraints c, int x, int y, int width, int height) {
c.gridx = x;
c.gridy = y;
c.gridwidth = width;
c.gridheight = height;
panel.add(component, c);
}
public void initializeComponents() {
nomLabel = new JLabel("Nom :");
prenomLabel = new JLabel("Prénom :");
numEtdLabel = new JLabel("Numéro étudiant :");
filiereLabel = new JLabel("Filière :");
niveauLabel = new JLabel("Niveau :");
groupeLabel = new JLabel("Groupe :");

nomField = new JTextField(15);
prenomField = new JTextField(20);
numEtdField = new JTextField(15);

// Sample data for comboboxes (replace with actual data source)
filiereComboBox = new JComboBox<>(new String[]{"FIA", "Licence Sc Info", "Licence Info de Gest", "Maths Info", "Physique Info", "Chimie Info", "Bio Info", "Eco Info", "Génie Info", "Info de Gestion", "Info de Comm"});
niveauComboBox = new JComboBox<>(new Integer[]{1, 2, 3});
groupeComboBox = new JComboBox<>(new Integer[]{1, 2, 3, 4, 5});

addButton = new JButton("Ajouter");
cancelButton = new JButton("Annuler");

}

public void createLayout() {
JPanel panel = new JPanel(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();

// Add labels and corresponding components
c.fill = GridBagConstraints.HORIZONTAL;
addComponent(panel, numEtdLabel, c, 0, 2, 1, 1);
addComponent(panel, numEtdField, c, 1, 2, 2, 1);
addComponent(panel, nomLabel, c, 0, 0, 1, 1);
addComponent(panel, nomField, c, 1, 0, 2, 1);
addComponent(panel, prenomLabel, c, 0, 1, 1, 1);
addComponent(panel, prenomField, c, 1, 1, 2, 1);
addComponent(panel, filiereLabel, c, 0, 3, 1, 1);
addComponent(panel, filiereComboBox, c, 1, 3, 2, 1);
addComponent(panel, niveauLabel, c, 0, 4, 1, 1);
addComponent(panel, niveauComboBox, c, 1, 4, 2, 1);
addComponent(panel, groupeLabel, c, 0, 5, 1, 1);
addComponent(panel, groupeComboBox, c, 1, 5, 2, 1);
addComponent(panel, addButton, c, 0, 6, 1, 1);
addComponent(panel, cancelButton, c, 1, 6, 1, 1);
add(panel);
}

}
9 changes: 9 additions & 0 deletions src/ExercicesTP/IHM/Principale.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public class Principale extends JFrame {
menuItemAjouteurEtudiant = new JMenuItem("Ajouteur");
menuItemRechercherEtudiant = new JMenuItem("Rechercher");
menuItemAfficherEtudiant = new JMenuItem("Afficher");

menuEtudiant.add(menuItemAjouteurEtudiant);
menuEtudiant.add(menuItemRechercherEtudiant);
menuEtudiant.add(menuItemAfficherEtudiant);
Expand Down Expand Up @@ -96,6 +97,14 @@ public void actionPerformed(ActionEvent e) {
}
});

menuItemAjouteurEtudiant.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
IHMAjoutEtudiant ihmAjoutEtud = new IHMAjoutEtudiant();
desktop.add(ihmAjoutEtud);
}
});




Expand Down

0 comments on commit 466a562

Please sign in to comment.