GUI.Cars.java Source code

Java tutorial

Introduction

Here is the source code for GUI.Cars.java

Source

/*
 * 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.
 */
package GUI;

import DAO.CarDAO;
import DAO.DepartementDAO;
import Entities.Car;
import Entities.Departement;
import Utils.ConnectedUser;
import com.itextpdf.text.BaseColor;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Font;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.pdf.PdfWriter;
import java.io.FileOutputStream;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author Marwen
 */
public class Cars extends javax.swing.JFrame {

    private static Font catFont = new Font(Font.FontFamily.TIMES_ROMAN, 18, Font.BOLD);
    private static Font redFont = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL, BaseColor.RED);
    private static Font subFont = new Font(Font.FontFamily.TIMES_ROMAN, 16, Font.BOLD);
    private static Font smallBold = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD);

    /**
     * Creates new form InterfaceVehicule
     */
    public Cars() {
        initComponents();
    }

    /**
     * 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">//GEN-BEGIN:initComponents
    private void initComponents() {

        jButton1 = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        dateMiseEnCirculationET = new javax.swing.JTextField();
        concessionnaireET = new javax.swing.JTextField();
        departmentET = new javax.swing.JTextField();
        immatriculationET = new javax.swing.JTextField();
        puissanceET = new javax.swing.JTextField();
        nombreDePlaceET = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        marqueET = new javax.swing.JTextField();
        categorieSP = new javax.swing.JComboBox();
        numChassisET = new javax.swing.JTextField();
        indexKmET = new javax.swing.JTextField();
        carburantSP = new javax.swing.JComboBox();
        typeUtilisationET = new javax.swing.JComboBox();
        jLabel16 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        montantAssuranceET = new javax.swing.JTextField();
        compagnieAssuranceET = new javax.swing.JTextField();
        etatSP = new javax.swing.JComboBox();
        jLabel17 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        jLabel23 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        jLabel25 = new javax.swing.JLabel();
        montantVignietteET = new javax.swing.JTextField();
        montantTaxeET = new javax.swing.JTextField();
        prixAchatET = new javax.swing.JTextField();
        immatriculationCB = new javax.swing.JCheckBox();
        searchImmatriculationET = new javax.swing.JTextField();
        departementCB = new javax.swing.JCheckBox();
        utilisationCB = new javax.swing.JCheckBox();
        searchDepartementET = new javax.swing.JTextField();
        searchUtilisationET = new javax.swing.JTextField();
        seachBT = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        tableJT = new javax.swing.JTable();
        printBT = new javax.swing.JButton();
        addCarBT = new javax.swing.JButton();
        dateReformeET = new javax.swing.JTextField();
        jLabel27 = new javax.swing.JLabel();
        dateDebutAssuranceET = new javax.swing.JTextField();
        dateProchaineAssuranceET = new javax.swing.JTextField();
        dateProchaineVignietteET = new javax.swing.JTextField();
        dateProchaineTaxeET = new javax.swing.JTextField();
        cancelBT = new javax.swing.JButton();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenuItem2 = new javax.swing.JMenuItem();
        jMenuItem3 = new javax.swing.JMenuItem();
        jMenuItem4 = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem5 = new javax.swing.JMenuItem();
        jMenuItem6 = new javax.swing.JMenuItem();
        jMenuItem7 = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();
        jMenuItem8 = new javax.swing.JMenuItem();
        jMenuItem9 = new javax.swing.JMenuItem();
        jMenu4 = new javax.swing.JMenu();
        jMenuItem10 = new javax.swing.JMenuItem();
        jMenuItem11 = new javax.swing.JMenuItem();
        jMenuItem12 = new javax.swing.JMenuItem();
        jMenu5 = new javax.swing.JMenu();
        jMenuItem13 = new javax.swing.JMenuItem();
        jMenuItem14 = new javax.swing.JMenuItem();
        jMenuItem15 = new javax.swing.JMenuItem();
        jMenu6 = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jButton1.setText("Deconnecter");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jLabel1.setText("Bienvenue Mr");

        jLabel2.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N
        jLabel2.setForeground(new java.awt.Color(0, 51, 153));
        jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel2.setText("Ajouter Vehicule");

        jLabel3.setText("Immatricultion");

        jLabel4.setText("Dpartement");

        jLabel5.setText("Conessionnaire");

        jLabel6.setText("Date premiere mise en circulation");

        jLabel7.setText("Puissance");

        jLabel8.setText("Nombre de place");

        jLabel9.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N
        jLabel9.setForeground(new java.awt.Color(0, 51, 153));
        jLabel9.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel9.setText("Rechercher");

        immatriculationET.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                immatriculationETActionPerformed(evt);
            }
        });

        jLabel10.setText("Marque");

        jLabel11.setText("Catgorie");

        jLabel12.setText("N de chassis");

        jLabel13.setText("Index km");

        jLabel14.setText("Carburant");

        jLabel15.setText("Type d'utilisation");

        categorieSP.setModel(
                new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        carburantSP.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Essence", "Diesel", "Gaz" }));

        typeUtilisationET.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Fonction", "Service" }));

        jLabel16.setText("Etat");

        jLabel18.setText("Comapnie d'assurance");

        jLabel19.setText("Date dbut d'assurance");

        jLabel20.setText("Date prochaine assurance");

        jLabel21.setText("Montant assurance");

        etatSP.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Bonne", "Moyenne", "Mauvaise" }));
        etatSP.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                etatSPActionPerformed(evt);
            }
        });

        jLabel17.setText("Date prochaine vignette");

        jLabel22.setText("Montant vignette");

        jLabel23.setText("Date prochaine taxes");

        jLabel24.setText("Montant taxes");

        jLabel25.setText("Prix d'achat");

        immatriculationCB.setText("Immatriculation");
        immatriculationCB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                immatriculationCBActionPerformed(evt);
            }
        });

        departementCB.setText("Dpartement");

        utilisationCB.setText("Utilisation");

        seachBT.setText("Afficher");
        seachBT.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                seachBTActionPerformed(evt);
            }
        });

        tableJT.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, null, null },
                        { null, null, null, null, null, null, null, null, null, null, null },
                        { null, null, null, null, null, null, null, null, null, null, null } },
                new String[] { "Immatriculation", "Marque", "Categorie", "Date PMC", "Dpartement", "Prix d'achat",
                        "Prochaine assurance", "Prochaine taxes", "Prochaine visite", "Etat", "Utilisation" }));
        jScrollPane1.setViewportView(tableJT);

        printBT.setText("Imprimmer");
        printBT.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                printBTActionPerformed(evt);
            }
        });

        addCarBT.setText("Ajouter");
        addCarBT.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addCarBTActionPerformed(evt);
            }
        });

        jLabel27.setText("Date reforme");

        cancelBT.setText("Annuler");
        cancelBT.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cancelBTActionPerformed(evt);
            }
        });

        jMenu1.setText("Vehicule");

        jMenuItem2.setText("Ajouter vehicule");
        jMenu1.add(jMenuItem2);

        jMenuItem3.setText("Etat des vehicules dans une anne");
        jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem3ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem3);

        jMenuItem4.setText("Alertes");
        jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem4ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem4);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("Rparation");

        jMenuItem5.setText("Ajouter une rparation");
        jMenuItem5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem5ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem5);

        jMenuItem6.setText("Etat des rparations dans une anne");
        jMenuItem6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem6ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem6);

        jMenuItem7.setText("Alertes");
        jMenuItem7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem7ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem7);

        jMenuBar1.add(jMenu2);

        jMenu3.setText("Carburant");

        jMenuItem8.setText("Ajouter une consommation");
        jMenuItem8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem8ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem8);

        jMenuItem9.setText("Etat des consommations dans une anne");
        jMenuItem9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem9ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem9);

        jMenuBar1.add(jMenu3);

        jMenu4.setText("Magasin");

        jMenuItem10.setText("Ajouter un article");
        jMenuItem10.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem10ActionPerformed(evt);
            }
        });
        jMenu4.add(jMenuItem10);

        jMenuItem11.setText("Etat des consommations dans une anne");
        jMenuItem11.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem11ActionPerformed(evt);
            }
        });
        jMenu4.add(jMenuItem11);

        jMenuItem12.setText("Alertes");
        jMenuItem12.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem12ActionPerformed(evt);
            }
        });
        jMenu4.add(jMenuItem12);

        jMenuBar1.add(jMenu4);

        jMenu5.setText("Atelier");

        jMenuItem13.setText("Ajouter un bon de lavage");
        jMenuItem13.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem13ActionPerformed(evt);
            }
        });
        jMenu5.add(jMenuItem13);

        jMenuItem14.setText("Demander un article");
        jMenuItem14.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem14ActionPerformed(evt);
            }
        });
        jMenu5.add(jMenuItem14);

        jMenuItem15.setText("Etat des consommations dans une anne");
        jMenuItem15.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem15ActionPerformed(evt);
            }
        });
        jMenu5.add(jMenuItem15);

        jMenuBar1.add(jMenu5);

        jMenu6.setText("Parametrage");
        jMenuBar1.add(jMenu6);

        setJMenuBar(jMenuBar1);

        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.TRAILING, false)
                        .addGroup(layout.createSequentialGroup().addGroup(layout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addGroup(layout.createSequentialGroup().addGroup(
                                        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(jLabel4).addComponent(jLabel3).addComponent(jLabel5))
                                        .addGap(123, 123, 123)
                                        .addGroup(layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(concessionnaireET,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, 82, Short.MAX_VALUE)
                                                .addComponent(departmentET).addComponent(immatriculationET)))
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                        .addGroup(layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(jLabel7).addComponent(jLabel6).addComponent(jLabel8))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addGroup(layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
                                                        false)
                                                .addComponent(nombreDePlaceET, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        82, Short.MAX_VALUE)
                                                .addComponent(dateMiseEnCirculationET).addComponent(puissanceET))))
                                .addGap(32, 32, 32)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(layout.createSequentialGroup().addGroup(layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(jLabel10).addComponent(jLabel11)
                                                .addComponent(jLabel12).addComponent(jLabel13)
                                                .addComponent(jLabel14))
                                                .addGroup(layout
                                                        .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment.LEADING)
                                                        .addGroup(layout.createSequentialGroup().addGap(24, 24, 24)
                                                                .addGroup(layout.createParallelGroup(
                                                                        javax.swing.GroupLayout.Alignment.LEADING)
                                                                        .addComponent(jLabel2)
                                                                        .addGroup(layout.createParallelGroup(
                                                                                javax.swing.GroupLayout.Alignment.TRAILING,
                                                                                false)
                                                                                .addComponent(indexKmET,
                                                                                        javax.swing.GroupLayout.Alignment.LEADING)
                                                                                .addComponent(numChassisET,
                                                                                        javax.swing.GroupLayout.Alignment.LEADING)
                                                                                .addComponent(marqueET,
                                                                                        javax.swing.GroupLayout.Alignment.LEADING)
                                                                                .addComponent(categorieSP,
                                                                                        javax.swing.GroupLayout.Alignment.LEADING,
                                                                                        0,
                                                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                                        Short.MAX_VALUE))))
                                                        .addGroup(layout.createSequentialGroup().addGap(26, 26, 26)
                                                                .addComponent(carburantSP,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE))))
                                        .addGroup(layout.createSequentialGroup().addComponent(jLabel15)
                                                .addPreferredGap(
                                                        javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                .addComponent(typeUtilisationET,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addGroup(layout.createSequentialGroup().addGap(90, 90, 90)
                                                .addComponent(jLabel9))))
                        .addGroup(layout.createSequentialGroup().addComponent(immatriculationCB)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(searchImmatriculationET, javax.swing.GroupLayout.PREFERRED_SIZE, 69,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18).addComponent(departementCB)))
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createSequentialGroup().addGap(35, 35, 35).addGroup(layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jLabel20).addComponent(jLabel16).addComponent(jLabel21)
                                        .addComponent(jLabel19)
                                        .addGroup(layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                                        false)
                                                .addComponent(jLabel27, javax.swing.GroupLayout.Alignment.LEADING,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                .addComponent(jLabel18, javax.swing.GroupLayout.Alignment.LEADING,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 82,
                                                Short.MAX_VALUE)
                                        .addGroup(layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(etatSP, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addGroup(layout
                                                        .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment.TRAILING, false)
                                                        .addComponent(compagnieAssuranceET,
                                                                javax.swing.GroupLayout.Alignment.LEADING,
                                                                javax.swing.GroupLayout.DEFAULT_SIZE, 79,
                                                                Short.MAX_VALUE)
                                                        .addComponent(dateReformeET,
                                                                javax.swing.GroupLayout.Alignment.LEADING))
                                                .addComponent(dateDebutAssuranceET,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 79,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addGroup(layout
                                                        .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment.TRAILING, false)
                                                        .addComponent(montantAssuranceET,
                                                                javax.swing.GroupLayout.Alignment.LEADING,
                                                                javax.swing.GroupLayout.DEFAULT_SIZE, 79,
                                                                Short.MAX_VALUE)
                                                        .addComponent(dateProchaineAssuranceET,
                                                                javax.swing.GroupLayout.Alignment.LEADING))))
                                .addGroup(layout.createSequentialGroup()
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(searchDepartementET, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                77, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(utilisationCB).addGap(18, 18, 18)
                                        .addComponent(searchUtilisationET, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                50, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(0, 0, Short.MAX_VALUE)))
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createSequentialGroup().addGap(15, 15, 15).addGroup(layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jLabel17).addComponent(jLabel22).addComponent(jLabel23)
                                        .addComponent(jLabel24).addComponent(jLabel25)).addGap(18, 18, 18)
                                        .addGroup(layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(prixAchatET).addComponent(dateProchaineVignietteET)
                                                .addComponent(dateProchaineTaxeET)
                                                .addComponent(montantVignietteET,
                                                        javax.swing.GroupLayout.Alignment.TRAILING)
                                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                                        layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE)
                                                                .addComponent(montantTaxeET,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 74,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                                        .addContainerGap())
                                .addGroup(
                                        layout.createSequentialGroup().addGap(110, 110, 110).addComponent(addCarBT)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(cancelBT).addContainerGap(
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                        layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE)
                                                .addComponent(seachBT).addGap(125, 125, 125))))
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                        layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE).addComponent(jLabel1)
                                .addGap(63, 63, 63).addComponent(jButton1))
                .addGroup(layout.createSequentialGroup().addContainerGap()
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 805,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18).addComponent(printBT)
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
        layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup().addGroup(layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jButton1).addComponent(jLabel1))
                        .addGroup(layout.createSequentialGroup().addGap(22, 22, 22).addComponent(jLabel2)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                        .addGroup(layout.createSequentialGroup().addGroup(layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                                .addGroup(layout.createSequentialGroup().addGroup(layout
                                                        .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment.TRAILING)
                                                        .addComponent(jLabel3)
                                                        .addGroup(layout
                                                                .createParallelGroup(
                                                                        javax.swing.GroupLayout.Alignment.BASELINE)
                                                                .addComponent(immatriculationET,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                .addComponent(jLabel10)
                                                                .addComponent(marqueET,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                .addComponent(jLabel16)
                                                                .addComponent(etatSP,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                .addComponent(jLabel17)
                                                                .addComponent(dateProchaineVignietteET,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                                                        .addGroup(layout
                                                                .createParallelGroup(
                                                                        javax.swing.GroupLayout.Alignment.LEADING)
                                                                .addGroup(layout.createSequentialGroup()
                                                                        .addPreferredGap(
                                                                                javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                                        .addGroup(layout.createParallelGroup(
                                                                                javax.swing.GroupLayout.Alignment.LEADING)
                                                                                .addGroup(layout
                                                                                        .createParallelGroup(
                                                                                                javax.swing.GroupLayout.Alignment.TRAILING)
                                                                                        .addComponent(jLabel4)
                                                                                        .addComponent(departmentET,
                                                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                                                                .addGroup(layout
                                                                                        .createParallelGroup(
                                                                                                javax.swing.GroupLayout.Alignment.BASELINE)
                                                                                        .addComponent(categorieSP,
                                                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                                        .addComponent(jLabel22)
                                                                                        .addComponent(
                                                                                                montantVignietteET,
                                                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                                        .addComponent(dateReformeET,
                                                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                                                javax.swing.GroupLayout.PREFERRED_SIZE))))
                                                                .addGroup(layout.createSequentialGroup()
                                                                        .addGap(10, 10, 10)
                                                                        .addComponent(jLabel27))))
                                                .addComponent(jLabel11))
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addGroup(layout
                                                        .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment.LEADING)
                                                        .addGroup(layout
                                                                .createParallelGroup(
                                                                        javax.swing.GroupLayout.Alignment.TRAILING)
                                                                .addComponent(jLabel5)
                                                                .addComponent(concessionnaireET,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                                        .addComponent(dateProchaineTaxeET,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)))
                                        .addGroup(layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(jLabel12)
                                                .addComponent(numChassisET, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(jLabel18)
                                                .addComponent(compagnieAssuranceET,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(jLabel23)))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                                layout.createSequentialGroup().addGroup(layout
                                                        .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment.TRAILING)
                                                        .addComponent(jLabel6,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE, 14,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addGroup(layout
                                                                .createParallelGroup(
                                                                        javax.swing.GroupLayout.Alignment.BASELINE)
                                                                .addComponent(dateMiseEnCirculationET,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                .addComponent(jLabel13)
                                                                .addComponent(indexKmET,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                .addComponent(jLabel19).addComponent(jLabel24)
                                                                .addComponent(montantTaxeET,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                .addComponent(
                                                                        dateDebutAssuranceET,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                                                        .addPreferredGap(
                                                                javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                        .addGroup(layout
                                                                .createParallelGroup(
                                                                        javax.swing.GroupLayout.Alignment.BASELINE)
                                                                .addComponent(jLabel7)
                                                                .addComponent(puissanceET,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                .addComponent(jLabel14)
                                                                .addComponent(carburantSP,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                .addComponent(jLabel20).addComponent(jLabel25)
                                                                .addComponent(prixAchatET,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                .addComponent(
                                                                        dateProchaineAssuranceET,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                                        .addPreferredGap(
                                                                javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                        .addGroup(layout
                                                                .createParallelGroup(
                                                                        javax.swing.GroupLayout.Alignment.LEADING)
                                                                .addComponent(jLabel8)
                                                                .addGroup(layout.createParallelGroup(
                                                                        javax.swing.GroupLayout.Alignment.BASELINE)
                                                                        .addComponent(addCarBT)
                                                                        .addComponent(cancelBT))))
                                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(nombreDePlaceET,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(jLabel15)
                                                .addComponent(typeUtilisationET,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(jLabel21).addComponent(montantAssuranceET,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE)
                                                .addGroup(layout
                                                        .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment.BASELINE)
                                                        .addComponent(immatriculationCB)
                                                        .addComponent(searchImmatriculationET,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)))
                                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout
                                                .createSequentialGroup().addComponent(jLabel9)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                .addGroup(layout
                                                        .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment.BASELINE)
                                                        .addComponent(departementCB)
                                                        .addComponent(searchDepartementET,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addComponent(utilisationCB)
                                                        .addComponent(searchUtilisationET,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addComponent(seachBT))))))
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createSequentialGroup().addGap(18, 18, 18).addComponent(
                                        jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 91,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(layout.createSequentialGroup().addGap(36, 36, 36).addComponent(printBT)))
                        .addContainerGap(213, Short.MAX_VALUE)));

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed

        new CarsAlerts().setVisible(true);
        this.setVisible(false);
    }//GEN-LAST:event_jMenuItem4ActionPerformed

    private void jMenuItem8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem8ActionPerformed
        new Carburant().setVisible(true);
        this.setVisible(false);

    }//GEN-LAST:event_jMenuItem8ActionPerformed

    private void jMenuItem11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem11ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItem11ActionPerformed

    private void jMenuItem12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem12ActionPerformed

        new ArticleAlerts().setVisible(true);
        this.setVisible(false);

    }//GEN-LAST:event_jMenuItem12ActionPerformed

    private void immatriculationETActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_immatriculationETActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_immatriculationETActionPerformed

    private void immatriculationCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_immatriculationCBActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_immatriculationCBActionPerformed

    private void seachBTActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_seachBTActionPerformed

        CarDAO carDao = new CarDAO();
        List<Car> cars = new ArrayList<>();
        if (immatriculationCB.isSelected() && !departementCB.isSelected() && !utilisationCB.isSelected()) {
            cars.add(carDao.getCarByImmatriculation(searchImmatriculationET.getText()));
        } else if (!immatriculationCB.isSelected() && departementCB.isSelected() && !utilisationCB.isSelected()) {
            cars.addAll(carDao.getCarByDepartement(searchDepartementET.getText()));
        } else if (!immatriculationCB.isSelected() && !departementCB.isSelected() && utilisationCB.isSelected()) {
            cars.addAll(carDao.getCarByUtilisation(searchUtilisationET.getText()));
        }

        /// add to the table
        Object[] tableColumnNames = new Object[11];
        tableColumnNames[0] = "Immatriculation";
        tableColumnNames[1] = "Marque";
        tableColumnNames[2] = "Categorie";
        tableColumnNames[3] = "Date fin Assurance";
        tableColumnNames[4] = "Departement";
        tableColumnNames[5] = "Prix achat";
        tableColumnNames[6] = "Date fin Assurance";
        tableColumnNames[7] = "Date fin Vignette";
        tableColumnNames[8] = "Date fin taxes";
        tableColumnNames[9] = "Etat";
        tableColumnNames[10] = "Utilisation";
        DefaultTableModel tbd = new DefaultTableModel();
        tbd.setColumnIdentifiers(tableColumnNames);
        Object[] RowService = new Object[11];
        this.tableJT.setModel(tbd);
        for (int i = 0; i < cars.size(); i++) {
            RowService[0] = cars.get(i).getImmatriculation();
            RowService[1] = cars.get(i).getMarque();
            RowService[2] = cars.get(i).getCategory();
            RowService[3] = cars.get(i).getDateProchaineAssurance().toString();
            RowService[4] = cars.get(i).getDepartement().getNom();
            RowService[5] = cars.get(i).getPrixAchat();
            RowService[6] = cars.get(i).getDateProchaineAssurance().toString();
            RowService[7] = cars.get(i).getDateProchaineVigniette().toString();
            RowService[8] = cars.get(i).getDateProchaineTaxe().toString();
            RowService[9] = cars.get(i).getEtat();
            RowService[10] = cars.get(i).getUtilisation();
            tbd.addRow(RowService);

        }

    }//GEN-LAST:event_seachBTActionPerformed

    private void addCarBTActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addCarBTActionPerformed

        Car car = new Car();
        car.setImmatriculation(immatriculationET.getText());
        Departement dep = new Departement();

        DepartementDAO depDAO = new DepartementDAO();
        if (depDAO.findDepartement(departmentET.getText()) != null) {
            dep = depDAO.findDepartement(departmentET.getText());
        } else {
            depDAO.addDepartement(departmentET.getText());
            dep = depDAO.findDepartement(departmentET.getText());

        }

        car.setDepartement(dep);

        car.setConcessionnaire(concessionnaireET.getText());

        try {
            DateFormat format = new SimpleDateFormat("dd-MM-yyyy", Locale.ENGLISH);
            Date date;
            date = format.parse(dateMiseEnCirculationET.getText());
            car.setDateDeMiseEnCirculation(date);

        } catch (ParseException ex) {
            Logger.getLogger(Cars.class.getName()).log(Level.SEVERE, null, ex);
        }

        car.setPuissance(Integer.parseInt(puissanceET.getText()));
        car.setNombreDePlaces(Integer.parseInt(nombreDePlaceET.getText()));
        car.setMarque(marqueET.getText());
        car.setCategory(categorieSP.getSelectedItem().toString());
        car.setNumDeChassis(Integer.parseInt(numChassisET.getText()));
        car.setIndexKm(Integer.parseInt(indexKmET.getText()));
        car.setCarburant(carburantSP.getSelectedItem().toString());
        car.setUtilisation(typeUtilisationET.getSelectedItem().toString());
        car.setEtat(etatSP.getSelectedItem().toString());

        try {
            DateFormat format = new SimpleDateFormat("dd-MM-yyyy", Locale.ENGLISH);
            Date date;
            date = format.parse(dateReformeET.getText());
            car.setDateDeReforme(date);

        } catch (ParseException ex) {
            Logger.getLogger(Cars.class.getName()).log(Level.SEVERE, null, ex);
        }

        car.setCompagnieDassurance(compagnieAssuranceET.getText());

        try {
            DateFormat format = new SimpleDateFormat("dd-MM-yyyy", Locale.ENGLISH);
            Date date;
            date = format.parse(dateDebutAssuranceET.getText());
            car.setDateDebutDassurance(date);

        } catch (ParseException ex) {
            Logger.getLogger(Cars.class.getName()).log(Level.SEVERE, null, ex);
        }
        try {
            DateFormat format = new SimpleDateFormat("dd-MM-yyyy", Locale.ENGLISH);
            Date date;
            date = format.parse(dateProchaineAssuranceET.getText());
            car.setDateProchaineAssurance(date);

        } catch (ParseException ex) {
            Logger.getLogger(Cars.class.getName()).log(Level.SEVERE, null, ex);
        }
        car.setMontantAssurance(Float.parseFloat(montantAssuranceET.getText()));
        try {
            DateFormat format = new SimpleDateFormat("dd-MM-yyyy", Locale.ENGLISH);
            Date date;
            date = format.parse(dateProchaineVignietteET.getText());
            car.setDateProchaineVigniette(date);

        } catch (ParseException ex) {
            Logger.getLogger(Cars.class.getName()).log(Level.SEVERE, null, ex);
        }
        car.setMontantVigniette(Float.parseFloat(montantVignietteET.getText()));
        try {
            DateFormat format = new SimpleDateFormat("dd-MM-yyyy", Locale.ENGLISH);
            Date date;
            date = format.parse(dateProchaineTaxeET.getText());
            car.setDateProchaineTaxe(date);

        } catch (ParseException ex) {
            Logger.getLogger(Cars.class.getName()).log(Level.SEVERE, null, ex);
        }
        car.setMontantTaxeVigniette(Float.parseFloat(montantTaxeET.getText()));
        car.setPrixAchat(Float.parseFloat(prixAchatET.getText()));

        CarDAO carDAO = new CarDAO();
        carDAO.addCar(car);
    }//GEN-LAST:event_addCarBTActionPerformed

    private void cancelBTActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelBTActionPerformed

        immatriculationET.setText("");
        departmentET.setText("");
        concessionnaireET.setText("");
        dateMiseEnCirculationET.setText("");
        puissanceET.setText("");
        nombreDePlaceET.setText("");
        marqueET.setText("");
        numChassisET.setText("");
        indexKmET.setText("");
        dateReformeET.setText("");
        compagnieAssuranceET.setText("");
        dateDebutAssuranceET.setText("");
        dateProchaineAssuranceET.setText("");
        montantAssuranceET.setText("");
        dateProchaineVignietteET.setText("");
        montantVignietteET.setText("");
        dateProchaineTaxeET.setText("");
        montantTaxeET.setText("");
        prixAchatET.setText("");

    }//GEN-LAST:event_cancelBTActionPerformed

    private void printBTActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_printBTActionPerformed
        try {
            Document document = new Document();
            PdfWriter.getInstance(document, new FileOutputStream("/home/marwen/Desktop/carsList.pdf"));
            document.open();
            addMetaData(document);
            addTitlePage(document);
            //addContent(document);
            document.close();
        } catch (Exception e) {
            e.printStackTrace();
        } // TODO add your handling code here:

    }

    // iText allows to add metadata to the PDF which can be viewed in your Adobe
    // Reader
    // under File -> Properties
    private static void addMetaData(Document document) {
        document.addTitle("Cars PDF");
        document.addSubject("subject");
        document.addKeywords("Car Fleet Management, PDF, JAVA");
        document.addAuthor("Marwen");
        document.addCreator("Marwen");
    }

    private void addTitlePage(Document document) throws DocumentException {
        Paragraph preface = new Paragraph();
        // We add one empty line
        addEmptyLine(preface, 1);
        // Lets write a big header
        preface.add(new Paragraph("Cars", catFont));

        addEmptyLine(preface, 1);

        preface.add(new Paragraph(
                "Report generated by: " + System.getProperty("Car Fleet Management App") + ", " + new Date(),
                smallBold));
        addEmptyLine(preface, 3);

        preface.add(new Paragraph("Car details ", smallBold));

        int rowNumber = this.tableJT.getSelectedRow();

        // immatriculation
        preface.add(new Paragraph("Immatriculation : ", redFont));
        preface.add(new Paragraph(this.tableJT.getValueAt(rowNumber, 0).toString(), smallBold));

        //marque
        preface.add(new Paragraph("Marque : ", redFont));
        preface.add(new Paragraph(this.tableJT.getValueAt(rowNumber, 2).toString(), smallBold));

        //etat
        preface.add(new Paragraph("Etat : ", redFont));
        preface.add(new Paragraph(this.tableJT.getValueAt(rowNumber, 9).toString(), smallBold));

        addEmptyLine(preface, 3);
        preface.add(new Paragraph("Thank you for using Car Fleet Management App", smallBold));

        document.add(preface);
        // Start a new page
        document.newPage();
    }

    private static void addEmptyLine(Paragraph paragraph, int number) {
        for (int i = 0; i < number; i++) {
            paragraph.add(new Paragraph(" "));
        }

    }//GEN-LAST:event_printBTActionPerformed

    private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed

        new CarsStats().setVisible(true);
        this.setVisible(false);

    }//GEN-LAST:event_jMenuItem3ActionPerformed

    private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed
        new Fixings().setVisible(true);
        this.setVisible(false);
    }//GEN-LAST:event_jMenuItem5ActionPerformed

    private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem6ActionPerformed

        new FixingStats().setVisible(true);
        this.setVisible(false);
    }//GEN-LAST:event_jMenuItem6ActionPerformed

    private void jMenuItem7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem7ActionPerformed
        new FixingsAlerts().setVisible(true);
        this.setVisible(false);

    }//GEN-LAST:event_jMenuItem7ActionPerformed

    private void jMenuItem9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem9ActionPerformed

        new CarburantStats().setVisible(true);
        this.setVisible(false);
    }//GEN-LAST:event_jMenuItem9ActionPerformed

    private void jMenuItem10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem10ActionPerformed

        new Articles().setVisible(true);
        this.setVisible(false);

    }//GEN-LAST:event_jMenuItem10ActionPerformed

    private void jMenuItem13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem13ActionPerformed

        new BonLavage().setVisible(true);
        this.setVisible(false);

    }//GEN-LAST:event_jMenuItem13ActionPerformed

    private void jMenuItem14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem14ActionPerformed

        new DemandesArticles().setVisible(true);
        this.setVisible(false);

    }//GEN-LAST:event_jMenuItem14ActionPerformed

    private void jMenuItem15ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem15ActionPerformed

    }//GEN-LAST:event_jMenuItem15ActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed

        ConnectedUser.setCurrentConnectedUser(null);
        new Login().setVisible(true);
        this.setVisible(false);

    }//GEN-LAST:event_jButton1ActionPerformed

    private void etatSPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_etatSPActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_etatSPActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        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(Cars.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Cars.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Cars.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Cars.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Cars().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton addCarBT;
    private javax.swing.JButton cancelBT;
    private javax.swing.JComboBox carburantSP;
    private javax.swing.JComboBox categorieSP;
    private javax.swing.JTextField compagnieAssuranceET;
    private javax.swing.JTextField concessionnaireET;
    private javax.swing.JTextField dateDebutAssuranceET;
    private javax.swing.JTextField dateMiseEnCirculationET;
    private javax.swing.JTextField dateProchaineAssuranceET;
    private javax.swing.JTextField dateProchaineTaxeET;
    private javax.swing.JTextField dateProchaineVignietteET;
    private javax.swing.JTextField dateReformeET;
    private javax.swing.JCheckBox departementCB;
    private javax.swing.JTextField departmentET;
    private javax.swing.JComboBox etatSP;
    private javax.swing.JCheckBox immatriculationCB;
    private javax.swing.JTextField immatriculationET;
    private javax.swing.JTextField indexKmET;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenu jMenu5;
    private javax.swing.JMenu jMenu6;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem10;
    private javax.swing.JMenuItem jMenuItem11;
    private javax.swing.JMenuItem jMenuItem12;
    private javax.swing.JMenuItem jMenuItem13;
    private javax.swing.JMenuItem jMenuItem14;
    private javax.swing.JMenuItem jMenuItem15;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JMenuItem jMenuItem5;
    private javax.swing.JMenuItem jMenuItem6;
    private javax.swing.JMenuItem jMenuItem7;
    private javax.swing.JMenuItem jMenuItem8;
    private javax.swing.JMenuItem jMenuItem9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextField marqueET;
    private javax.swing.JTextField montantAssuranceET;
    private javax.swing.JTextField montantTaxeET;
    private javax.swing.JTextField montantVignietteET;
    private javax.swing.JTextField nombreDePlaceET;
    private javax.swing.JTextField numChassisET;
    private javax.swing.JButton printBT;
    private javax.swing.JTextField prixAchatET;
    private javax.swing.JTextField puissanceET;
    private javax.swing.JButton seachBT;
    private javax.swing.JTextField searchDepartementET;
    private javax.swing.JTextField searchImmatriculationET;
    private javax.swing.JTextField searchUtilisationET;
    private javax.swing.JTable tableJT;
    private javax.swing.JComboBox typeUtilisationET;
    private javax.swing.JCheckBox utilisationCB;
    // End of variables declaration//GEN-END:variables
}