Application Java sur la gestion des notes
Application Java sur la gestion des notes
Cet article propose en détaille une application en Java sur la gestion des notes gratuits et faciles à utiliser.
Cette application Java sur la gestion des notes est un petit projet réalisé en java Eclipse qui a pour bute de gérer des notes d'une école dont le code source est à votre disposition.
Vous pourrez télécharger le fichier au format zip il contient le code sources les classes, les modules, les images et la base de donnée
On trouve aussi des classes, interfaces et modules pour la gestion des élèves, cours, professeurs, activités, résultats et activités pratiqués
Avant d’accéder à l’interface d’accueil il faut s’authentifier en entrant le nom d’utilisateur et le mot de passe.
Aperçu du codage de certaines classes de l’application :
Classe « ListActivité »
Package Affichage;
import java.sql.*;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.table.DefaultTableModel;
import connection.connection;
public class listAct extends javax.swing.JFrame{/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
private JButton bfer;
private String query = "SELECT * FROM activites order by nomAct asc";
//public class FenetreListeProduit extends javax.swing.JFrame {
Statement stListe;
connection maconnexion = new connection();
/**
* Creates new form FenetreListeProduitl
*/
public listAct() {
this.setLocation(500, 200);
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
initComponents();
DefaultTableModel model=new DefaultTableModel();
model.addColumn("Niveau ");
model.addColumn("Nom d'activité");
model.addColumn("Club");
/* model.addColumn("Date_Nai");
model.addColumn("Poids");
model.addColumn("Annee");*/
TABLEPRO.setModel(model);
try{
stListe=maconnexion.etablirconnection().createStatement();
ResultSet resultat =stListe.executeQuery(query);
while(resultat.next()){
model.addRow(new Object []{ resultat.getString("Niveau"),resultat.getString("nomAct"),resultat.getString("equipet")});
}
}catch(SQLException ex){
System.out.println(ex);
}
bfer=new JButton("Fermer");
bfer.setBounds(75,150,100,30);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
TABLE = new javax.swing.JScrollPane();
TABLEPRO = new javax.swing.JTable();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jLabel1.setText("LISTE DES ACTIVITES");
TABLEPRO.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null,null},
{null, null, null, null,null},
{null, null, null, null,null},
{null, null, null, null,null}
},
new String [] {
"Title 1", "Title 2", "Title 3"
}
));
TABLE.setViewportView(TABLEPRO);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addGroup(layout.createSequentialGroup()
.addGap(22, 22, 22)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 282, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(TABLE, javax.swing.GroupLayout.PREFERRED_SIZE, 375, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(15, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(TABLE, javax.swing.GroupLayout.PREFERRED_SIZE, 275, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
pack();
}// </editor-fold>
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(listAct.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(listAct.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(listAct.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(listAct.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
// Create and display the form
/*.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new listAct().setVisible(true);
} });*/
}
// Variables declaration - do not modify
private javax.swing.JScrollPane TABLE;
private javax.swing.JTable TABLEPRO;
private javax.swing.JLabel jLabel1;
// End of variables declaration
}
…
Class « ListeCours »
package Affichage;
import java.sql.*;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.table.DefaultTableModel;
import connection.connection;
public class listcours extends javax.swing.JFrame{/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
private JButton bfer;
//public class FenetreListeProduit extends javax.swing.JFrame {
Statement stListe;
connection maconnexion = new connection();
/**
* Creates new form FenetreListeProduitl
*/
public listcours() {
initComponents();
this.setLocation(500, 200);
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
DefaultTableModel model=new DefaultTableModel();
model.addColumn("Numero ");
model.addColumn("Nom cours");
model.addColumn("Nbre heure");
model.addColumn("annee");
/* model.addColumn("Date_Nai");
model.addColumn("Poids");
model.addColumn("Annee");*/
TABLEPRO.setModel(model);
String requeteListe="select * from cours";
try{
stListe=maconnexion.etablirconnection().createStatement();
ResultSet resultat =stListe.executeQuery(requeteListe);
while(resultat.next()){
model.addRow(new Object []{ resultat.getString("num_crs"),resultat.getString("nom_crs"),resultat.getString("nbrH"),resultat.getString("ann")});
}
}catch(SQLException ex){
System.out.println(ex);
}
bfer=new JButton("Fermer");
bfer.setBounds(75,150,100,30);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
TABLE = new javax.swing.JScrollPane();
TABLEPRO = new javax.swing.JTable();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
jLabel1.setText("LISTE DES COURS ");
TABLEPRO.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null,null},
{null, null, null, null,null},
{null, null, null, null,null},
{null, null, null, null,null}
},
new String [] {
"Title 1", "Title 2", "Title 3"
}
));
TABLE.setViewportView(TABLEPRO);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(22, 22, 22)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 282, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(TABLE, javax.swing.GroupLayout.PREFERRED_SIZE, 375, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(15, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(TABLE, javax.swing.GroupLayout.PREFERRED_SIZE, 275, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
pack();
}// </editor-fold>
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(listcours.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(listcours.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(listcours.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(listcours.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
// Create and display the form
/* java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new listcours().setVisible(true);
}
});*/
}
// Variables declaration - do not modify
private javax.swing.JScrollPane TABLE;
private javax.swing.JTable TABLEPRO;
private javax.swing.JLabel jLabel1;
// End of variables declaration
}