Projet JAVA sur la gestion de location de voiture
![Projet JAVA sur la gestion de location de voiture](/images/remos_downloads/id-11068_t_prev.jpg)
Projet JAVA sur la gestion de location de voiture
Cet article propose en détaille projet JAVA sur la gestion de location de voiture
Vous pourrez télécharger le fichier au format zip il contient le code sources, les classes, les images et la base de donnée.
Cette application faite en JAVA en utilisant les classes swing et une base de données, elle concerne la gestion de location de voiture, contrat, facture, réservation...etc.
Extrait du code source :
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.rmi.UnknownHostException;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import javax.imageio.IIOException;
import javax.imageio.ImageIO;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.JToolBar;
import javax.swing.KeyStroke;
import javax.swing.border.Border;
public class Accueil extends JFrame {
private static final JMenuItem Bon_de_reservation = null;
private JMenuBar menuBar = new JMenuBar();
private JMenu edition = new JMenu("Edition");
private JMenu location = new JMenu("Vehicule");
private JMenu clients = new JMenu("Clients");
private JMenu facture = new JMenu("Facture");
private JMenu reservation = new JMenu("Réservation");
private JMenu contrat = new JMenu("Contrat");
private JMenuItem bdd = new JMenuItem("Base de données");
private JMenu aide = new JMenu("Aide");
private JMenu user = new JMenu("Utilisateurs");
public static String adr;
private JMenu config = new JMenu("Paramètres");
private JMenuItem serveur = new JMenuItem("Envoyer message au serveur");
private JMenuItem factura = new JMenuItem("Facture");
private JMenuItem aide_support = new JMenuItem("Aide et Support");
private static JMenuItem liste_poste = new JMenuItem("Liste des membres CSL connectés");
private JMenuItem liste_tout = new JMenuItem("Liste du groupe CSL");
private JMenuItem liste_client = new JMenuItem("Liste de tout les clients");
private JMenuItem liste_client_attente = new JMenuItem("Liste des clients en attente");
private JMenuItem liste_client_cours = new JMenuItem("Liste des clients sous contrat");
static JMenuItem liste_voiture_libre = new JMenuItem("Liste des vehicules disponible");
static JMenuItem liste_voiture_sorties = new JMenuItem("Liste des vehicule sorties");
static JMenuItem liste_voiture_reserve = new JMenuItem("Liste des vehicule réservés");
private JMenuItem liste_voiture_retard = new JMenuItem("Liste des vehicule en retard");
private JMenuItem tout_voiture = new JMenuItem("Liste de toutes les voitures");
private JMenuItem nouvelle_facture = new JMenuItem("Nouvelle Facture");
private JMenuItem annuler_contrat = new JMenuItem("Annuler un contrat");
private JMenuItem contrat_listes = new JMenuItem("Liste des contrats");
private JMenuItem facture_listes = new JMenuItem("Liste des factures");
private JMenuItem contrat_de_location = new JMenuItem("Contrat de location");
private JMenuItem bon_de_reservation = new JMenuItem("Bon de reservation");
private JMenuItem liste_des_reservation = new JMenuItem("Liste des réservation");
private JMenuItem fermer = new JMenuItem("Fermer");
private JMenu maj_voiture = new JMenu("Mise à jour");
private JMenuItem consulter_vehicule = new JMenuItem("Consulter");
private JMenuItem ajouter_vehicule = new JMenuItem("Créer");
private JMenuItem modifier_vehicule = new JMenuItem("Modifier");
private JMenuItem supprimer_vehicule = new JMenuItem("Supprimer");
private JMenu maj_user = new JMenu("Mise à jour");
private JMenuItem consulter = new JMenuItem("Consulter");
private JMenuItem ajouter = new JMenuItem("Créer");
private JMenuItem modifier = new JMenuItem("Modifier");
private JMenuItem supprimer = new JMenuItem("Supprimer");
final Background contient= new Background();
final Background2 contient2= new Background2();
private static JSplitPane split;
private static JPanel menu = new JPanel();
private JTabbedPane p;
private static boolean ok =false, gauche=true, droite=false,haut=false,bas=false;
private static String rowCount,rowCount2,rowCount3,rowCount4,rowCount5,rowCount6;
private int row1,row2,row3,row4,row6;
private JTextField text3,text1,text2,text4,text6;
public static int onglet = JTabbedPane.LEFT;
public Accueil(boolean ok){
this.ok=ok;
}
public Accueil(){
this.setTitle("Chabanus Sheep Auto Location ");
this.setSize(new Dimension(800, 600));
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setLocationRelativeTo(null);
fermer.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
System.exit(0);
}
});
this.config.add(bdd);
this.config.add(fermer);
// NOUVELLE FACTURE
nouvelle_facture.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
facture();
}
});
icone_facture.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
facture();
}
contrat_de_location.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
try {
marques();
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
icone_contrat.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
try {
marques();
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
annuler_contrat.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
annuler_contra();
}
contrat_listes.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
String requete = "SELECT id,nom,prenom,nss,marque,modele FROM facture WHERE statut='sortie' ORDER BY id ";
contrat_list(requete);
}
liste_des_reservation.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
String requete = "SELECT id,nom,prenom,nss,marque,modele FROM facture WHERE statut='attente' ORDER BY id ";
reservation_list(requete);
}
connecte.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
String requete = "SELECT id,nom,prenom,nss,marque,modele FROM facture WHERE statut='sortie' ORDER BY id ";
contrat_list(requete);
}
facture1.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
String requete = "SELECT id,nom,prenom,nss,marque,modele FROM facture WHERE statut='regler' ORDER BY id ";
facture_list(requete);
}
bon_de_reservation.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
try {
try {
Reserva l = new Reserva(null, "Réservation : Informations Véhicule", true);
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NotBoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
icone_reserva.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
try {
try {
Reserva l = new Reserva(null, "Réservation : Informations Véhicule", true);
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NotBoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
reservee.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
String requete = "SELECT id,nom,prenom,nss,marque,modele FROM facture WHERE statut='attente' ORDER BY id ";
reservation_list(requete);
}
sortie1.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
String requete = "SELECT marque,modele FROM vehicule WHERE statut = 'sortie' ORDER BY marque";
vehicule(requete);
}
facture_listes.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
String requete = "SELECT id,nom,prenom,nss,marque,modele FROM facture WHERE statut='regler' ORDER BY id ";
facture_list(requete);
}
liste_client.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
String requete = "SELECT nom,prenom,nss,adresse,tel,permis,etat FROM client ORDER BY id ";
clients(requete);
}
client.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
String requete = "SELECT nom,prenom,nss,adresse,tel,permis,etat FROM client ORDER BY id ";
clients(requete);
}
liste_client_cours.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
String requete = "SELECT nom,prenom,etat FROM client WHERE etat='servis' ORDER BY id ";
clients(requete);
}
liste_client_attente.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
String requete = "SELECT nom,prenom,etat FROM client WHERE etat='reserve' ORDER BY id ";
clients(requete);
}
// LISTE VOITURES DISPONIBLE
liste_voiture_libre.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
String requete = "SELECT marque,modele FROM vehicule WHERE statut = 'disponible' ORDER BY marque ";
vehicule(requete);
}
disponible.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
String requete = "SELECT marque,modele FROM vehicule WHERE statut = 'disponible' ORDER BY marque ";
vehicule(requete);
}
liste_voiture_sorties.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
String requete = "SELECT marque,modele FROM vehicule WHERE statut = 'sortie' ORDER BY marque";
vehicule(requete);
}
liste_voiture_reserve.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
String requete = "SELECT marque,modele FROM vehicule WHERE statut = 'reserve' ORDER BY marque";
vehicule(requete);
}
reserve.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
String requete = "SELECT marque,modele FROM vehicule WHERE statut = 'reserve' ORDER BY marque";
vehicule(requete);
liste_voiture_retard.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
String requete = "SELECT marque,modele FROM vehicule WHERE statut = 'retard' ORDER BY marque";
vehicule(requete);
}
tout_voiture.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
vehicule_tout();
}
getListe_poste().addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
String requete = "SELECT log FROM utilisateurs WHERE statut = 'en ligne' ";
user(requete);
}
liste_tout.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
user();
/*commander.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
Client zd = new Client(null, "Commander Véhicule", true);
ClientInfo zInfo = zd.showZDialog();
JOptionPane jop = new JOptionPane();
jop.showMessageDialog(null, zInfo.toString(), "Commander vehicule", JOptionPane.INFORMATION_MESSAGE);
….